#1213 - DDC-3437 - refactoring tests to support embeddable class name != embeddable class property declaring class
This commit is contained in:
parent
d48546d2dd
commit
d259ba91b3
@ -15,20 +15,18 @@ use ReflectionProperty;
|
||||
class ReflectionEmbeddedPropertyTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @param ReflectionProperty $parentProperty
|
||||
* @param ReflectionProperty $childProperty
|
||||
* @param ReflectionProperty $parentProperty property of the embeddable/entity where to write the embeddable to
|
||||
* @param ReflectionProperty $childProperty property of the embeddable class where to write values to
|
||||
* @param string $embeddableClass name of the embeddable class to be instantiated
|
||||
*
|
||||
* @dataProvider getTestedReflectionProperties
|
||||
*/
|
||||
public function testCanSetAndGetEmbeddedProperty(
|
||||
ReflectionProperty $parentProperty,
|
||||
ReflectionProperty $childProperty
|
||||
ReflectionProperty $childProperty,
|
||||
$embeddableClass
|
||||
) {
|
||||
$embeddedPropertyReflection = new ReflectionEmbeddedProperty(
|
||||
$parentProperty,
|
||||
$childProperty,
|
||||
$childProperty->getDeclaringClass()->getName()
|
||||
);
|
||||
$embeddedPropertyReflection = new ReflectionEmbeddedProperty($parentProperty, $childProperty, $embeddableClass);
|
||||
|
||||
$instantiator = new Instantiator();
|
||||
|
||||
@ -44,21 +42,18 @@ class ReflectionEmbeddedPropertyTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ReflectionProperty $parentProperty
|
||||
* @param ReflectionProperty $childProperty
|
||||
* @param ReflectionProperty $parentProperty property of the embeddable/entity where to write the embeddable to
|
||||
* @param ReflectionProperty $childProperty property of the embeddable class where to write values to
|
||||
* @param string $embeddableClass name of the embeddable class to be instantiated
|
||||
*
|
||||
* @dataProvider getTestedReflectionProperties
|
||||
*/
|
||||
public function testWillSkipReadingPropertiesFromNullEmbeddable(
|
||||
ReflectionProperty $parentProperty,
|
||||
ReflectionProperty $childProperty
|
||||
)
|
||||
{
|
||||
$embeddedPropertyReflection = new ReflectionEmbeddedProperty(
|
||||
$parentProperty,
|
||||
$childProperty,
|
||||
$childProperty->getDeclaringClass()->getName()
|
||||
);
|
||||
ReflectionProperty $childProperty,
|
||||
$embeddableClass
|
||||
) {
|
||||
$embeddedPropertyReflection = new ReflectionEmbeddedProperty($parentProperty, $childProperty, $embeddableClass);
|
||||
|
||||
$instantiator = new Instantiator();
|
||||
|
||||
@ -88,7 +83,7 @@ class ReflectionEmbeddedPropertyTest extends \PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* Data provider
|
||||
*
|
||||
* @return ReflectionProperty[][]
|
||||
* @return ReflectionProperty[][]|string[][]
|
||||
*/
|
||||
public function getTestedReflectionProperties()
|
||||
{
|
||||
@ -102,6 +97,7 @@ class ReflectionEmbeddedPropertyTest extends \PHPUnit_Framework_TestCase
|
||||
'Doctrine\\Tests\\Models\\Generic\\BooleanModel',
|
||||
'id'
|
||||
),
|
||||
'Doctrine\\Tests\\Models\\Generic\\BooleanModel'
|
||||
),
|
||||
// reflection on classes extending internal PHP classes:
|
||||
array(
|
||||
@ -113,6 +109,7 @@ class ReflectionEmbeddedPropertyTest extends \PHPUnit_Framework_TestCase
|
||||
'Doctrine\\Tests\\Models\\Reflection\\ArrayObjectExtendingClass',
|
||||
'privateProperty'
|
||||
),
|
||||
'Doctrine\\Tests\\Models\\Reflection\\ArrayObjectExtendingClass'
|
||||
),
|
||||
array(
|
||||
$this->getReflectionProperty(
|
||||
@ -123,6 +120,7 @@ class ReflectionEmbeddedPropertyTest extends \PHPUnit_Framework_TestCase
|
||||
'Doctrine\\Tests\\Models\\Reflection\\ArrayObjectExtendingClass',
|
||||
'protectedProperty'
|
||||
),
|
||||
'Doctrine\\Tests\\Models\\Reflection\\ArrayObjectExtendingClass'
|
||||
),
|
||||
array(
|
||||
$this->getReflectionProperty(
|
||||
@ -133,6 +131,7 @@ class ReflectionEmbeddedPropertyTest extends \PHPUnit_Framework_TestCase
|
||||
'Doctrine\\Tests\\Models\\Reflection\\ArrayObjectExtendingClass',
|
||||
'publicProperty'
|
||||
),
|
||||
'Doctrine\\Tests\\Models\\Reflection\\ArrayObjectExtendingClass'
|
||||
),
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user