You are here

public function ProxyMagicMethodsTest::testInheritedMagicSleep in Plug 7

File

lib/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyMagicMethodsTest.php, line 148

Class

ProxyMagicMethodsTest
Test for behavior of proxies with inherited magic methods

Namespace

Doctrine\Tests\Common\Proxy

Code

public function testInheritedMagicSleep() {
  $proxyClassName = $this
    ->generateProxyClass(__NAMESPACE__ . '\\MagicSleepClass');
  $proxy = new $proxyClassName();
  $this
    ->assertSame('defaultValue', $proxy->serializedField);
  $this
    ->assertSame('defaultValue', $proxy->nonSerializedField);
  $proxy->serializedField = 'changedValue';
  $proxy->nonSerializedField = 'changedValue';
  $unserialized = unserialize(serialize($proxy));
  $this
    ->assertSame('changedValue', $unserialized->serializedField);
  $this
    ->assertSame('defaultValue', $unserialized->nonSerializedField, 'Field was not returned by "__sleep"');
}