#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
|
class ReflectionEmbeddedPropertyTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param ReflectionProperty $parentProperty
|
* @param ReflectionProperty $parentProperty property of the embeddable/entity where to write the embeddable to
|
||||||
* @param ReflectionProperty $childProperty
|
* @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
|
* @dataProvider getTestedReflectionProperties
|
||||||
*/
|
*/
|
||||||
public function testCanSetAndGetEmbeddedProperty(
|
public function testCanSetAndGetEmbeddedProperty(
|
||||||
ReflectionProperty $parentProperty,
|
ReflectionProperty $parentProperty,
|
||||||
ReflectionProperty $childProperty
|
ReflectionProperty $childProperty,
|
||||||
|
$embeddableClass
|
||||||
) {
|
) {
|
||||||
$embeddedPropertyReflection = new ReflectionEmbeddedProperty(
|
$embeddedPropertyReflection = new ReflectionEmbeddedProperty($parentProperty, $childProperty, $embeddableClass);
|
||||||
$parentProperty,
|
|
||||||
$childProperty,
|
|
||||||
$childProperty->getDeclaringClass()->getName()
|
|
||||||
);
|
|
||||||
|
|
||||||
$instantiator = new Instantiator();
|
$instantiator = new Instantiator();
|
||||||
|
|
||||||
@ -44,21 +42,18 @@ class ReflectionEmbeddedPropertyTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ReflectionProperty $parentProperty
|
* @param ReflectionProperty $parentProperty property of the embeddable/entity where to write the embeddable to
|
||||||
* @param ReflectionProperty $childProperty
|
* @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
|
* @dataProvider getTestedReflectionProperties
|
||||||
*/
|
*/
|
||||||
public function testWillSkipReadingPropertiesFromNullEmbeddable(
|
public function testWillSkipReadingPropertiesFromNullEmbeddable(
|
||||||
ReflectionProperty $parentProperty,
|
ReflectionProperty $parentProperty,
|
||||||
ReflectionProperty $childProperty
|
ReflectionProperty $childProperty,
|
||||||
)
|
$embeddableClass
|
||||||
{
|
) {
|
||||||
$embeddedPropertyReflection = new ReflectionEmbeddedProperty(
|
$embeddedPropertyReflection = new ReflectionEmbeddedProperty($parentProperty, $childProperty, $embeddableClass);
|
||||||
$parentProperty,
|
|
||||||
$childProperty,
|
|
||||||
$childProperty->getDeclaringClass()->getName()
|
|
||||||
);
|
|
||||||
|
|
||||||
$instantiator = new Instantiator();
|
$instantiator = new Instantiator();
|
||||||
|
|
||||||
@ -88,7 +83,7 @@ class ReflectionEmbeddedPropertyTest extends \PHPUnit_Framework_TestCase
|
|||||||
/**
|
/**
|
||||||
* Data provider
|
* Data provider
|
||||||
*
|
*
|
||||||
* @return ReflectionProperty[][]
|
* @return ReflectionProperty[][]|string[][]
|
||||||
*/
|
*/
|
||||||
public function getTestedReflectionProperties()
|
public function getTestedReflectionProperties()
|
||||||
{
|
{
|
||||||
@ -102,6 +97,7 @@ class ReflectionEmbeddedPropertyTest extends \PHPUnit_Framework_TestCase
|
|||||||
'Doctrine\\Tests\\Models\\Generic\\BooleanModel',
|
'Doctrine\\Tests\\Models\\Generic\\BooleanModel',
|
||||||
'id'
|
'id'
|
||||||
),
|
),
|
||||||
|
'Doctrine\\Tests\\Models\\Generic\\BooleanModel'
|
||||||
),
|
),
|
||||||
// reflection on classes extending internal PHP classes:
|
// reflection on classes extending internal PHP classes:
|
||||||
array(
|
array(
|
||||||
@ -113,6 +109,7 @@ class ReflectionEmbeddedPropertyTest extends \PHPUnit_Framework_TestCase
|
|||||||
'Doctrine\\Tests\\Models\\Reflection\\ArrayObjectExtendingClass',
|
'Doctrine\\Tests\\Models\\Reflection\\ArrayObjectExtendingClass',
|
||||||
'privateProperty'
|
'privateProperty'
|
||||||
),
|
),
|
||||||
|
'Doctrine\\Tests\\Models\\Reflection\\ArrayObjectExtendingClass'
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
$this->getReflectionProperty(
|
$this->getReflectionProperty(
|
||||||
@ -123,6 +120,7 @@ class ReflectionEmbeddedPropertyTest extends \PHPUnit_Framework_TestCase
|
|||||||
'Doctrine\\Tests\\Models\\Reflection\\ArrayObjectExtendingClass',
|
'Doctrine\\Tests\\Models\\Reflection\\ArrayObjectExtendingClass',
|
||||||
'protectedProperty'
|
'protectedProperty'
|
||||||
),
|
),
|
||||||
|
'Doctrine\\Tests\\Models\\Reflection\\ArrayObjectExtendingClass'
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
$this->getReflectionProperty(
|
$this->getReflectionProperty(
|
||||||
@ -133,6 +131,7 @@ class ReflectionEmbeddedPropertyTest extends \PHPUnit_Framework_TestCase
|
|||||||
'Doctrine\\Tests\\Models\\Reflection\\ArrayObjectExtendingClass',
|
'Doctrine\\Tests\\Models\\Reflection\\ArrayObjectExtendingClass',
|
||||||
'publicProperty'
|
'publicProperty'
|
||||||
),
|
),
|
||||||
|
'Doctrine\\Tests\\Models\\Reflection\\ArrayObjectExtendingClass'
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user