You are here

public function ProxyMagicMethodsTest::testInheritedMagicGetByRef in Plug 7

@group DCOM-194

File

lib/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;
}