From b9090ef73ee2d00b6d1c4dec61f9498cc46d2e2c Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Wed, 10 Sep 2014 16:40:17 +0200 Subject: [PATCH] DDC-3272 - failing test (to be run in insulation because of autoloading) that verifies that a wrong annotation is generated for `@MappedSuperclass` --- .../Tests/ORM/Tools/EntityGeneratorTest.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php index 1a41dee83..07abaaaf6 100644 --- a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php @@ -284,6 +284,36 @@ class EntityGeneratorTest extends \Doctrine\Tests\OrmTestCase $this->assertEquals($cm->customRepositoryClassName, $metadata->customRepositoryClassName); } + /** + * @group DDC-3272 + */ + public function testMappedSuperclassAnnotationGeneration() + { + $metadata = new ClassMetadataInfo($this->_namespace . '\EntityGeneratorBook'); + + $metadata->namespace = $this->_namespace; + $metadata->isMappedSuperclass = true; + + $this->_generator->setAnnotationPrefix('ORM\\'); + $this->_generator->writeEntityClass($metadata, $this->_tmpDir); + + // force instantiation (causes autoloading to kick in) + $this->newInstance($metadata); + + $driver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver( + new \Doctrine\Common\Annotations\AnnotationReader(), + array() + ); + + $cm = new \Doctrine\ORM\Mapping\ClassMetadata($metadata->name); + + $cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService); + + $driver->loadMetadataForClass($cm->name, $cm); + + $this->assertTrue($cm->isMappedSuperclass); + } + /** * @dataProvider getParseTokensInEntityFileData */