You are here

public function DriverChainTest::testDelegateToMatchingNamespaceDriver in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ChainDriverTest.php \Doctrine\Tests\Common\Persistence\Mapping\DriverChainTest::testDelegateToMatchingNamespaceDriver()

File

vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ChainDriverTest.php, line 10

Class

DriverChainTest

Namespace

Doctrine\Tests\Common\Persistence\Mapping

Code

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));
}