You are here

public function Framework_MockObjectTest::testMockArgumentsPassedByReference in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit-mock-objects/tests/MockObjectTest.php \Framework_MockObjectTest::testMockArgumentsPassedByReference()

See https://github.com/sebastianbergmann/phpunit-mock-objects/issues/81

File

vendor/phpunit/phpunit-mock-objects/tests/MockObjectTest.php, line 678

Class

Framework_MockObjectTest
@since Class available since Release 3.0.0

Code

public function testMockArgumentsPassedByReference() {
  $foo = $this
    ->getMockBuilder('MethodCallbackByReference')
    ->setMethods(array(
    'bar',
  ))
    ->disableOriginalConstructor()
    ->disableArgumentCloning()
    ->getMock();
  $foo
    ->expects($this
    ->any())
    ->method('bar')
    ->will($this
    ->returnCallback(array(
    $foo,
    'callback',
  )));
  $a = $b = $c = 0;
  $foo
    ->bar($a, $b, $c);
  $this
    ->assertEquals(1, $b);
}