diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php index 36b92f81d..4a7882862 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php @@ -7,6 +7,8 @@ use Doctrine\Common\Persistence\Mapping\StaticReflectionService; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Events; use Doctrine\ORM\Mapping\DefaultNamingStrategy; +use Doctrine\Tests\Models\DirectoryTree\AbstractContentItem; +use Doctrine\Tests\Models\DirectoryTree\File; require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php'; @@ -1152,6 +1154,41 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase $classMetadata->getAllReflectionProperties(); } + + /** + * @group DDC-2704 + */ + public function testGetAllReflectionPropertiesRetrievesCollidingPrivateProperties() + { + $classMetadata = new ClassMetadata(File::CLASSNAME); + + $classMetadata->initializeReflection(new RuntimeReflectionService()); + + $properties = $classMetadata->getAllReflectionProperties(); + + $this->assertInternalType('array', $properties); + $this->assertCount(5, $properties); + + $propertyNames = array_map( + function (\ReflectionProperty $property) { + return $property->getDeclaringClass()->getName() . '::' . $property->getName(); + }, + $properties + ); + + sort($propertyNames); + + $this->assertEquals( + [ + 'Doctrine\Tests\Models\DirectoryTree\AbstractContentItem::id', + 'Doctrine\Tests\Models\DirectoryTree\AbstractContentItem::name', + 'Doctrine\Tests\Models\DirectoryTree\AbstractContentItem::nodeIsLoaded', + 'Doctrine\Tests\Models\DirectoryTree\AbstractContentItem::parentDirectory', + 'Doctrine\Tests\Models\DirectoryTree\File::extension', + ], + $propertyNames + ); + } } /**