1
0
mirror of synced 2025-02-20 22:23:14 +03:00

Verifying that reflection properties that don't contain an embeddable will not crash reading properties, but will return null instead

This commit is contained in:
Marco Pivetta 2014-12-05 13:15:15 +01:00
parent b4a23e97a9
commit dcf824688a

View File

@ -42,6 +42,30 @@ class ReflectionEmbeddedPropertyTest extends \PHPUnit_Framework_TestCase
$this->assertSame('changedValue', $embeddedPropertyReflection->getValue($object));
}
/**
* @param ReflectionProperty $parentProperty
* @param ReflectionProperty $childProperty
*
* @dataProvider getTestedReflectionProperties
*/
public function testWillSkipReadingPropertiesFromNullEmbeddable(
ReflectionProperty $parentProperty,
ReflectionProperty $childProperty
)
{
$embeddedPropertyReflection = new ReflectionEmbeddedProperty(
$parentProperty,
$childProperty,
$childProperty->getDeclaringClass()->getName()
);
$instantiator = new Instantiator();
$this->assertNull($embeddedPropertyReflection->getValue(
$instantiator->instantiate($parentProperty->getDeclaringClass()->getName())
));
}
/**
* Data provider
*