public function Framework_MockObjectTest::testMockArgumentsPassedByReference2

File

drupal/core/vendor/phpunit/phpunit-mock-objects/Tests/MockObjectTest.php, line 586

Class

Framework_MockObjectTest
@package PHPUnit_MockObject @author Sebastian Bergmann <sb@sebastian-bergmann.de> @author Patrick Mueller <elias0@gmx.net> @author Frank Kleine <mikey@stubbles.net> @copyright 2010-2013 Sebastian Bergmann…

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);
}