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:
parent
b4a23e97a9
commit
dcf824688a
@ -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
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user