diff --git a/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php b/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php index cbc6d40a7..fdee6e8c2 100644 --- a/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php @@ -51,10 +51,9 @@ class ResolveTargetEntityListenerTest extends \Doctrine\Tests\OrmTestCase ); $evm->addEventSubscriber($this->listener); - $this->assertNotNull($this->factory->getMetadataFor('Doctrine\Tests\ORM\Tools\ResolveTargetInterface')); - - $cm = $this->factory->getMetadataFor('Doctrine\Tests\ORM\Tools\ResolveTargetEntity'); + $cm = $this->factory->getMetadataFor('Doctrine\Tests\ORM\Tools\ResolveTargetEntity'); $meta = $cm->associationMappings; + $this->assertSame('Doctrine\Tests\ORM\Tools\TargetEntity', $meta['manyToMany']['targetEntity']); $this->assertSame('Doctrine\Tests\ORM\Tools\ResolveTargetEntity', $meta['manyToOne']['targetEntity']); $this->assertSame('Doctrine\Tests\ORM\Tools\ResolveTargetEntity', $meta['oneToMany']['targetEntity']); @@ -63,6 +62,26 @@ class ResolveTargetEntityListenerTest extends \Doctrine\Tests\OrmTestCase $this->assertSame($cm, $this->factory->getMetadataFor('Doctrine\Tests\ORM\Tools\ResolveTargetInterface')); } + /** + * @group DDC-3385 + * @group 1181 + * @group 385 + */ + public function testResolveTargetEntityListenerCanRetrieveTargetEntityByInterfaceName() + { + $this->listener->addResolveTargetEntity( + 'Doctrine\Tests\ORM\Tools\ResolveTargetInterface', + 'Doctrine\Tests\ORM\Tools\ResolveTargetEntity', + array() + ); + + $this->em->getEventManager()->addEventSubscriber($this->listener); + + $cm = $this->factory->getMetadataFor('Doctrine\Tests\ORM\Tools\ResolveTargetInterface'); + + $this->assertSame($this->factory->getMetadataFor('Doctrine\Tests\ORM\Tools\ResolveTargetEntity'), $cm); + } + /** * @group DDC-2109 */