public function DriverChainTest::testDefaultDriver in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ChainDriverTest.php \Doctrine\Tests\Common\Persistence\Mapping\DriverChainTest::testDefaultDriver()
@group DDC-1412
File
- vendor/
doctrine/ common/ tests/ Doctrine/ Tests/ Common/ Persistence/ Mapping/ ChainDriverTest.php, line 93
Class
Namespace
Doctrine\Tests\Common\Persistence\MappingCode
public function testDefaultDriver() {
$companyDriver = $this
->getMock('Doctrine\\Common\\Persistence\\Mapping\\Driver\\MappingDriver');
$defaultDriver = $this
->getMock('Doctrine\\Common\\Persistence\\Mapping\\Driver\\MappingDriver');
$entityClassName = 'Doctrine\\Tests\\ORM\\Mapping\\DriverChainEntity';
$managerClassName = 'Doctrine\\Tests\\Models\\Company\\CompanyManager';
$chain = new MappingDriverChain();
$companyDriver
->expects($this
->never())
->method('loadMetadataForClass');
$companyDriver
->expects($this
->once())
->method('isTransient')
->with($this
->equalTo($managerClassName))
->will($this
->returnValue(false));
$defaultDriver
->expects($this
->never())
->method('loadMetadataForClass');
$defaultDriver
->expects($this
->once())
->method('isTransient')
->with($this
->equalTo($entityClassName))
->will($this
->returnValue(true));
$this
->assertNull($chain
->getDefaultDriver());
$chain
->setDefaultDriver($defaultDriver);
$chain
->addDriver($companyDriver, 'Doctrine\\Tests\\Models\\Company');
$this
->assertSame($defaultDriver, $chain
->getDefaultDriver());
$this
->assertTrue($chain
->isTransient($entityClassName));
$this
->assertFalse($chain
->isTransient($managerClassName));
}