public function RuntimePublicReflectionPropertyTest::testSetValueOnProxyPublicProperty in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/RuntimePublicReflectionPropertyTest.php \Doctrine\Tests\Common\Reflection\RuntimePublicReflectionPropertyTest::testSetValueOnProxyPublicProperty()
File
- vendor/
doctrine/ common/ tests/ Doctrine/ Tests/ Common/ Reflection/ RuntimePublicReflectionPropertyTest.php, line 32
Class
Namespace
Doctrine\Tests\Common\ReflectionCode
public function testSetValueOnProxyPublicProperty() {
$setCheckMock = $this
->getMock('stdClass', array(
'neverCallSet',
));
$setCheckMock
->expects($this
->never())
->method('neverCallSet');
$initializer = function () use ($setCheckMock) {
call_user_func(array(
$setCheckMock,
'neverCallSet',
));
};
$mockProxy = new RuntimePublicReflectionPropertyTestProxyMock();
$mockProxy
->__setInitializer($initializer);
$reflProperty = new RuntimePublicReflectionProperty(__NAMESPACE__ . '\\RuntimePublicReflectionPropertyTestProxyMock', 'checkedProperty');
$reflProperty
->setValue($mockProxy, 'newValue');
$this
->assertSame('newValue', $mockProxy->checkedProperty);
unset($mockProxy->checkedProperty);
$reflProperty
->setValue($mockProxy, 'otherNewValue');
$this
->assertSame('otherNewValue', $mockProxy->checkedProperty);
$setCheckMock = $this
->getMock('stdClass', array(
'callSet',
));
$setCheckMock
->expects($this
->once())
->method('callSet');
$initializer = function () use ($setCheckMock) {
call_user_func(array(
$setCheckMock,
'callSet',
));
};
$mockProxy
->__setInitializer($initializer);
$mockProxy
->__setInitialized(true);
unset($mockProxy->checkedProperty);
$reflProperty
->setValue($mockProxy, 'againNewValue');
$this
->assertSame('againNewValue', $mockProxy->checkedProperty);
}