_loadDriver(); $class = new ClassMetadata($className); $class->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService); $mappingDriver->loadMetadataForClass($className, $class); $expectedMap = array( "foo" => "Doctrine\Tests\ORM\Mapping\CTIFoo", "bar" => "Doctrine\Tests\ORM\Mapping\CTIBar", "baz" => "Doctrine\Tests\ORM\Mapping\CTIBaz", ); $this->assertEquals(3, count($class->discriminatorMap)); $this->assertEquals($expectedMap, $class->discriminatorMap); } public function testIdentifierWithAssociationKey() { $driver = $this->_loadDriver(); $em = $this->_getTestEntityManager(); $factory = new \Doctrine\ORM\Mapping\ClassMetadataFactory(); $em->getConfiguration()->setMetadataDriverImpl($driver); $factory->setEntityManager($em); $class = $factory->getMetadataFor('Doctrine\Tests\Models\DDC117\DDC117Translation'); $this->assertEquals(array('language', 'article'), $class->identifier); $this->assertArrayHasKey('article', $class->associationMappings); $this->assertArrayHasKey('id', $class->associationMappings['article']); $this->assertTrue($class->associationMappings['article']['id']); } /** * @group DDC-1468 * * @expectedException Doctrine\ORM\Mapping\MappingException * @expectedExceptionMessage Invalid mapping file 'Doctrine.Tests.Models.Generic.SerializationModel.dcm.xml' for class 'Doctrine\Tests\Models\Generic\SerializationModel'. */ public function testInvalidMappingFileException() { $this->createClassMetadata('Doctrine\Tests\Models\Generic\SerializationModel'); } /** * @param string $xmlMappingFile * @dataProvider dataValidSchema */ public function testValidateXmlSchema($xmlMappingFile) { $xsdSchemaFile = __DIR__ . "/../../../../../doctrine-mapping.xsd"; $dom = new \DOMDocument('UTF-8'); $dom->load($xmlMappingFile); $this->assertTrue($dom->schemaValidate($xsdSchemaFile)); } static public function dataValidSchema() { return array( array(__DIR__ . "/xml/Doctrine.Tests.ORM.Mapping.CTI.dcm.xml"), array(__DIR__ . "/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml"), array(__DIR__ . "/xml/CatNoId.dcm.xml"), ); } } class CTI { public $id; } class CTIFoo extends CTI {} class CTIBar extends CTI {} class CTIBaz extends CTI {}