1
0
mirror of synced 2024-12-14 23:26:04 +03:00
doctrine2/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php

58 lines
2.2 KiB
PHP
Raw Normal View History

<?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 YamlMappingDriverTest extends AbstractMappingDriverTest
{
protected function _loadDriver()
{
if (!class_exists('Symfony\Component\Yaml\Yaml', true)) {
2010-04-07 22:35:33 +04:00
$this->markTestSkipped('Please install Symfony YAML Component into the include path of your PHP installation.');
}
return new YamlDriver(__DIR__ . DIRECTORY_SEPARATOR . 'yaml');
}
/**
* @group DDC-671
*
* Entities for this test are in AbstractMappingDriverTest
*/
public function testJoinTablesWithMappedSuperclassForYamlDriver()
{
$yamlDriver = $this->_loadDriver();
$yamlDriver->addPaths(array(__DIR__ . DIRECTORY_SEPARATOR . 'yaml'));
2010-09-20 21:23:41 +04:00
$em = $this->_getTestEntityManager();
$em->getConfiguration()->setMetadataDriverImpl($yamlDriver);
$factory = new \Doctrine\ORM\Mapping\ClassMetadataFactory();
$factory->setEntityManager($em);
2010-09-20 21:23:41 +04:00
$classPage = new ClassMetadata('Doctrine\Tests\Models\DirectoryTree\File');
$classPage = $factory->getMetadataFor('Doctrine\Tests\Models\DirectoryTree\File');
$this->assertEquals('Doctrine\Tests\Models\DirectoryTree\File', $classPage->associationMappings['parentDirectory']['sourceEntity']);
2010-09-20 21:23:41 +04:00
$classDirectory = new ClassMetadata('Doctrine\Tests\Models\DirectoryTree\Directory');
$classDirectory = $factory->getMetadataFor('Doctrine\Tests\Models\DirectoryTree\Directory');
$this->assertEquals('Doctrine\Tests\Models\DirectoryTree\Directory', $classDirectory->associationMappings['parentDirectory']['sourceEntity']);
2010-07-06 22:19:43 +04:00
}
2011-12-15 23:12:01 +04:00
/**
* @group DDC-1468
*
* @expectedException Doctrine\ORM\Mapping\MappingException
* @expectedExceptionMessage Invalid mapping file 'Doctrine.Tests.Models.Generic.SerializationModel.dcm.yml' for class 'Doctrine\Tests\Models\Generic\SerializationModel'.
*/
public function testInvalidMappingFileException()
{
$this->createClassMetadata('Doctrine\Tests\Models\Generic\SerializationModel');
}
2010-07-06 22:19:43 +04:00
}