Drupal investigation

ProxyObjectTest.php 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /*
  3. * This file is part of the PHPUnit_MockObject package.
  4. *
  5. * (c) Sebastian Bergmann <sebastian@phpunit.de>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. /**
  11. * @since Class available since Release 2.0.0
  12. */
  13. class Framework_ProxyObjectTest extends PHPUnit_Framework_TestCase
  14. {
  15. public function testMockedMethodIsProxiedToOriginalMethod()
  16. {
  17. $proxy = $this->getMockBuilder('Bar')
  18. ->enableProxyingToOriginalMethods()
  19. ->getMock();
  20. $proxy->expects($this->once())
  21. ->method('doSomethingElse');
  22. $foo = new Foo;
  23. $this->assertEquals('result', $foo->doSomething($proxy));
  24. }
  25. public function testMockedMethodWithReferenceIsProxiedToOriginalMethod()
  26. {
  27. $proxy = $this->getMockBuilder('MethodCallbackByReference')
  28. ->enableProxyingToOriginalMethods()
  29. ->getMock();
  30. $a = $b = $c = 0;
  31. $proxy->callback($a, $b, $c);
  32. $this->assertEquals(1, $b);
  33. }
  34. }