You are here

public function ProxyMagicMethodsTest::testInheritedMagicSleep 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::testInheritedMagicSleep()

File

vendor/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"');
}