public function Framework_MockObjectTest::testFunctionCallback in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpunit/phpunit-mock-objects/tests/MockObjectTest.php \Framework_MockObjectTest::testFunctionCallback()
File
- vendor/
phpunit/ phpunit-mock-objects/ tests/ MockObjectTest.php, line 228
Class
- Framework_MockObjectTest
- @since Class available since Release 3.0.0
Code
public function testFunctionCallback() {
$mock = $this
->getMock('SomeClass', array(
'doSomething',
), array(), '', false);
$mock
->expects($this
->once())
->method('doSomething')
->will($this
->returnCallback('functionCallback'));
$this
->assertEquals('pass', $mock
->doSomething('foo', 'bar'));
$mock = $this
->getMock('SomeClass', array(
'doSomething',
), array(), '', false);
$mock
->expects($this
->once())
->method('doSomething')
->willReturnCallback('functionCallback');
$this
->assertEquals('pass', $mock
->doSomething('foo', 'bar'));
}