public function ProxyMagicMethodsTest::testInheritedMagicWakeup in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyMagicMethodsTest.php \Doctrine\Tests\Common\Proxy\ProxyMagicMethodsTest::testInheritedMagicWakeup()
File
- vendor/
doctrine/ common/ tests/ Doctrine/ Tests/ Common/ Proxy/ ProxyMagicMethodsTest.php, line 165
Class
- ProxyMagicMethodsTest
- Test for behavior of proxies with inherited magic methods
Namespace
Doctrine\Tests\Common\ProxyCode
public function testInheritedMagicWakeup() {
$proxyClassName = $this
->generateProxyClass(__NAMESPACE__ . '\\MagicWakeupClass');
$proxy = new $proxyClassName();
$this
->assertSame('defaultValue', $proxy->wakeupValue);
$proxy->wakeupValue = 'changedValue';
$unserialized = unserialize(serialize($proxy));
$this
->assertSame('newWakeupValue', $unserialized->wakeupValue, '"__wakeup" was called');
$unserialized
->__setInitializer(function (Proxy $proxy) {
$proxy
->__setInitializer(null);
$proxy->publicField = 'newPublicFieldValue';
});
$this
->assertSame('newPublicFieldValue', $unserialized->publicField, 'Proxy can still be initialized');
}