public function Framework_MockObjectTest::testStubbedReturnOnConsecutiveCalls in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/phpunit/phpunit-mock-objects/tests/MockObjectTest.php \Framework_MockObjectTest::testStubbedReturnOnConsecutiveCalls()
File
- vendor/
phpunit/ phpunit-mock-objects/ tests/ MockObjectTest.php, line 262
Class
- Framework_MockObjectTest
- @since Class available since Release 3.0.0
Code
public function testStubbedReturnOnConsecutiveCalls() {
$mock = $this
->getMock('AnInterface');
$mock
->expects($this
->any())
->method('doSomething')
->will($this
->onConsecutiveCalls('a', 'b', 'c'));
$this
->assertEquals('a', $mock
->doSomething());
$this
->assertEquals('b', $mock
->doSomething());
$this
->assertEquals('c', $mock
->doSomething());
$mock = $this
->getMock('AnInterface');
$mock
->expects($this
->any())
->method('doSomething')
->willReturnOnConsecutiveCalls('a', 'b', 'c');
$this
->assertEquals('a', $mock
->doSomething());
$this
->assertEquals('b', $mock
->doSomething());
$this
->assertEquals('c', $mock
->doSomething());
}