You are here

public function DriverChainTest::testGatherAllClassNames in Plug 7

File

lib/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ChainDriverTest.php, line 51

Class

DriverChainTest

Namespace

Doctrine\Tests\Common\Persistence\Mapping

Code

public function testGatherAllClassNames() {
  $className = 'Doctrine\\Tests\\Common\\Persistence\\Mapping\\DriverChainEntity';
  $classMetadata = $this
    ->getMock('Doctrine\\Common\\Persistence\\ClassMetadata');
  $chain = new MappingDriverChain();
  $driver1 = $this
    ->getMock('Doctrine\\Common\\Persistence\\Mapping\\Driver\\MappingDriver');
  $driver1
    ->expects($this
    ->once())
    ->method('getAllClassNames')
    ->will($this
    ->returnValue(array(
    'Doctrine\\Tests\\Models\\Company\\Foo',
  )));
  $driver2 = $this
    ->getMock('Doctrine\\Common\\Persistence\\Mapping\\Driver\\MappingDriver');
  $driver2
    ->expects($this
    ->once())
    ->method('getAllClassNames')
    ->will($this
    ->returnValue(array(
    'Doctrine\\Tests\\ORM\\Mapping\\Bar',
    'Doctrine\\Tests\\ORM\\Mapping\\Baz',
    'FooBarBaz',
  )));
  $chain
    ->addDriver($driver1, 'Doctrine\\Tests\\Models\\Company');
  $chain
    ->addDriver($driver2, 'Doctrine\\Tests\\ORM\\Mapping');
  $this
    ->assertEquals(array(
    'Doctrine\\Tests\\Models\\Company\\Foo',
    'Doctrine\\Tests\\ORM\\Mapping\\Bar',
    'Doctrine\\Tests\\ORM\\Mapping\\Baz',
  ), $chain
    ->getAllClassNames());
}