public function DriverChainTest::testDelegateToMatchingNamespaceDriver in Plug 7
File
- lib/
doctrine/ common/ tests/ Doctrine/ Tests/ Common/ Persistence/ Mapping/ ChainDriverTest.php, line 10
Class
Namespace
Doctrine\Tests\Common\Persistence\MappingCode
public function testDelegateToMatchingNamespaceDriver() {
$className = 'Doctrine\\Tests\\Common\\Persistence\\Mapping\\DriverChainEntity';
$classMetadata = $this
->getMock('Doctrine\\Common\\Persistence\\Mapping\\ClassMetadata');
$chain = new MappingDriverChain();
$driver1 = $this
->getMock('Doctrine\\Common\\Persistence\\Mapping\\Driver\\MappingDriver');
$driver1
->expects($this
->never())
->method('loadMetadataForClass');
$driver1
->expectS($this
->never())
->method('isTransient');
$driver2 = $this
->getMock('Doctrine\\Common\\Persistence\\Mapping\\Driver\\MappingDriver');
$driver2
->expects($this
->at(0))
->method('loadMetadataForClass')
->with($this
->equalTo($className), $this
->equalTo($classMetadata));
$driver2
->expects($this
->at(1))
->method('isTransient')
->with($this
->equalTo($className))
->will($this
->returnValue(true));
$chain
->addDriver($driver1, 'Doctrine\\Tests\\Models\\Company');
$chain
->addDriver($driver2, 'Doctrine\\Tests\\Common\\Persistence\\Mapping');
$chain
->loadMetadataForClass($className, $classMetadata);
$this
->assertTrue($chain
->isTransient($className));
}