minor fix to prior commit
[openemr.git] / vendor / phpunit / phpunit-mock-objects / tests / ProxyObjectTest.php
blob87a19fd866fef39bd1d979281f03adaf6365dc23
1 <?php
2 /*
3 * This file is part of the PHPUnit_MockObject package.
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
11 class Framework_ProxyObjectTest extends PHPUnit_Framework_TestCase
13 public function testMockedMethodIsProxiedToOriginalMethod()
15 $proxy = $this->getMockBuilder(Bar::class)
16 ->enableProxyingToOriginalMethods()
17 ->getMock();
19 $proxy->expects($this->once())
20 ->method('doSomethingElse');
22 $foo = new Foo;
24 $this->assertEquals('result', $foo->doSomething($proxy));
27 public function testMockedMethodWithReferenceIsProxiedToOriginalMethod()
29 $proxy = $this->getMockBuilder(MethodCallbackByReference::class)
30 ->enableProxyingToOriginalMethods()
31 ->getMock();
33 $a = $b = $c = 0;
35 $proxy->callback($a, $b, $c);
37 $this->assertEquals(1, $b);