public function DriverChainTest::testDefaultDriverGetAllClassNames in Plug 7
File
- lib/
doctrine/ common/ tests/ Doctrine/ Tests/ Common/ Persistence/ Mapping/ ChainDriverTest.php, line 126
Class
Namespace
Doctrine\Tests\Common\Persistence\MappingCode
public function testDefaultDriverGetAllClassNames() {
$companyDriver = $this
->getMock('Doctrine\\Common\\Persistence\\Mapping\\Driver\\MappingDriver');
$defaultDriver = $this
->getMock('Doctrine\\Common\\Persistence\\Mapping\\Driver\\MappingDriver');
$chain = new MappingDriverChain();
$companyDriver
->expects($this
->once())
->method('getAllClassNames')
->will($this
->returnValue(array(
'Doctrine\\Tests\\Models\\Company\\Foo',
)));
$defaultDriver
->expects($this
->once())
->method('getAllClassNames')
->will($this
->returnValue(array(
'Other\\Class',
)));
$chain
->setDefaultDriver($defaultDriver);
$chain
->addDriver($companyDriver, 'Doctrine\\Tests\\Models\\Company');
$classNames = $chain
->getAllClassNames();
$this
->assertEquals(array(
'Doctrine\\Tests\\Models\\Company\\Foo',
'Other\\Class',
), $classNames);
}