Skip to content

Instantly share code, notes, and snippets.

@mikedfunk
Created February 24, 2012 21:31
Show Gist options
  • Save mikedfunk/1903888 to your computer and use it in GitHub Desktop.
Save mikedfunk/1903888 to your computer and use it in GitHub Desktop.
PHPUnit CodeIgniter library mock example
<?php
// inside the test class...
// mock
require_once(BASEPATH.'libraries/email.php');
$this->_ci->email = $this->getMock('CI_Email');
$this->_ci->email->expects($this->any())
->method('send')
->will($this->returnValue(true));
$this->assertTrue($this->_ci->email->send());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment