1
0
mirror of synced 2025-01-19 15:01:40 +03:00

#385 #1181 DDC-3385 - splitting test case to verify interface-first fetching of metadata (via fallback logic)

This commit is contained in:
Marco Pivetta 2015-01-13 20:38:01 +01:00
parent 94a2036d50
commit f14063def5

View File

@ -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');
$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
*/