You are here

public function Framework_MockObjectTest::testMockArgumentsPassedByReference2 in Zircon Profile 8

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

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

File

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

Class

Framework_MockObjectTest
@since Class available since Release 3.0.0

Code

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