-
Notifications
You must be signed in to change notification settings - Fork 0
CIPHPUnitTestDouble
Mathieu Nayrolles edited this page Jan 20, 2016
·
1 revision
Part of CI PHPUnit Test
- Class name: CIPHPUnitTestDouble
- Namespace:
protected mixed $testCase
- Visibility: protected
mixed CIPHPUnitTestDouble::__construct(\PHPUnit_Framework_TestCase $testCase)
- Visibility: public
- $testCase PHPUnit_Framework_TestCase
object CIPHPUnitTestDouble::getDouble(string $classname, array $params)
Get Mock Object
$email = $this->getMockBuilder('CI_Email') ->setMethods(['send']) ->getMock(); $email->method('send')->willReturn(TRUE);
will be
$email = $this->getDouble('CI_Email', ['send' => TRUE]);
- Visibility: public
- $classname string
- $params array - <p>[method_name => return_value]</p>
mixed CIPHPUnitTestDouble::_verify($mock, $method, $params, $expects, $with)
- Visibility: protected
- $mock mixed
- $method mixed
- $params mixed
- $expects mixed
- $with mixed
mixed CIPHPUnitTestDouble::verifyInvokedMultipleTimes(object $mock, string $method, integer $times, array $params)
Verifies that method was called exactly $times times
$loader->expects($this->exactly(2)) ->method('view') ->withConsecutive( ['shop_confirm', $this->anything(), TRUE], ['shop_tmpl_checkout', $this->anything()] );
will be
$this->verifyInvokedMultipleTimes( $loader, 'view', 2, [ ['shop_confirm', $this->anything(), TRUE], ['shop_tmpl_checkout', $this->anything()] ] );
- Visibility: public
- $mock object - <p>PHPUnit mock object</p>
- $method string
- $times integer
- $params array - <p>arguments</p>
mixed CIPHPUnitTestDouble::verifyInvoked(object $mock, string $method, array $params)
Verifies a method was invoked at least once
- Visibility: public
- $mock object - <p>PHPUnit mock object</p>
- $method string
- $params array - <p>arguments</p>
mixed CIPHPUnitTestDouble::verifyInvokedOnce(object $mock, string $method, array $params)
Verifies that method was invoked only once
- Visibility: public
- $mock object - <p>PHPUnit mock object</p>
- $method string
- $params array - <p>arguments</p>
mixed CIPHPUnitTestDouble::verifyNeverInvoked(object $mock, string $method, array $params)
Verifies that method was not called
- Visibility: public
- $mock object - <p>PHPUnit mock object</p>
- $method string
- $params array - <p>arguments</p>