You are here

public function ProxyMagicMethodsTest::testInheritedMagicGetByRef in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyMagicMethodsTest.php \Doctrine\Tests\Common\Proxy\ProxyMagicMethodsTest::testInheritedMagicGetByRef()

@group DCOM-194

File

vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyMagicMethodsTest.php, line 100

Class

ProxyMagicMethodsTest
Test for behavior of proxies with inherited magic methods

Namespace

Doctrine\Tests\Common\Proxy

Code

public function testInheritedMagicGetByRef() {
  $proxyClassName = $this
    ->generateProxyClass(__NAMESPACE__ . '\\MagicGetByRefClass');

  /* @var $proxy \Doctrine\Tests\Common\Proxy\MagicGetByRefClass */
  $proxy = new $proxyClassName();
  $proxy->valueField = 123;
  $value =& $proxy
    ->__get('value');
  $this
    ->assertSame(123, $value);
  $value = 456;
  $this
    ->assertSame(456, $proxy
    ->__get('value'), 'Value was fetched by reference');
  $this
    ->setExpectedException('InvalidArgumentException');
  $undefined = $proxy->nonExisting;
}