2010-02-02 00:48:27 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\ORM\Mapping;
|
|
|
|
|
|
|
|
use Doctrine\ORM\Mapping\ClassMetadata,
|
|
|
|
Doctrine\ORM\Mapping\Driver\XmlDriver,
|
|
|
|
Doctrine\ORM\Mapping\Driver\YamlDriver;
|
|
|
|
|
|
|
|
require_once __DIR__ . '/../../TestInit.php';
|
|
|
|
|
|
|
|
class XmlMappingDriverTest extends AbstractMappingDriverTest
|
|
|
|
{
|
|
|
|
protected function _loadDriver()
|
|
|
|
{
|
|
|
|
return new XmlDriver(__DIR__ . DIRECTORY_SEPARATOR . 'xml');
|
|
|
|
}
|
2010-02-24 22:31:53 +03:00
|
|
|
|
|
|
|
public function testClassTableInheritanceDiscriminatorMap()
|
|
|
|
{
|
|
|
|
$className = 'Doctrine\Tests\ORM\Mapping\CTI';
|
|
|
|
$mappingDriver = $this->_loadDriver();
|
|
|
|
|
|
|
|
$class = new ClassMetadata($className);
|
|
|
|
$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);
|
|
|
|
}
|
2010-06-13 19:21:14 +04:00
|
|
|
|
|
|
|
public function testValidateXmlSchema()
|
|
|
|
{
|
|
|
|
$xsdSchemaFile = __DIR__ . "/../../../../../doctrine-mapping.xsd";
|
|
|
|
|
|
|
|
$dom = new \DOMDocument('UTF-8');
|
|
|
|
$dom->load(__DIR__ . "/xml/Doctrine.Tests.ORM.Mapping.CTI.dcm.xml");
|
|
|
|
$this->assertTrue($dom->schemaValidate($xsdSchemaFile));
|
|
|
|
|
|
|
|
$dom = new \DOMDocument('UTF-8');
|
|
|
|
$dom->load(__DIR__ . "/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml");
|
|
|
|
$this->assertTrue($dom->schemaValidate($xsdSchemaFile));
|
|
|
|
}
|
2010-02-24 22:31:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
class CTI
|
|
|
|
{
|
|
|
|
public $id;
|
|
|
|
}
|
|
|
|
|
|
|
|
class CTIFoo extends CTI {}
|
|
|
|
class CTIBar extends CTI {}
|
|
|
|
class CTIBaz extends CTI {}
|