1
0
mirror of synced 2025-02-02 21:41:45 +03:00

Test XML driver with failing SLC mapping

This commit is contained in:
Asmir Mustafic 2015-06-20 14:24:45 +02:00
parent 4da0ee9db8
commit 32f0fefec7
2 changed files with 35 additions and 0 deletions

View File

@ -32,6 +32,19 @@ class XmlMappingDriverTest extends AbstractMappingDriverTest
$this->assertEquals($expectedMap, $class->discriminatorMap); $this->assertEquals($expectedMap, $class->discriminatorMap);
} }
/**
* @expectedException Doctrine\ORM\Cache\CacheException
* @expectedExceptionMessage Entity association field "Doctrine\Tests\ORM\Mapping\XMLSLC#foo" not configured as part of the second-level cache.
*/
public function testFailingSecondLevelCacheAssociation()
{
$className = 'Doctrine\Tests\ORM\Mapping\XMLSLC';
$mappingDriver = $this->_loadDriver();
$class = new ClassMetadata($className);
$mappingDriver->loadMetadataForClass($className, $class);
}
public function testIdentifierWithAssociationKey() public function testIdentifierWithAssociationKey()
{ {
$driver = $this->_loadDriver(); $driver = $this->_loadDriver();
@ -176,3 +189,12 @@ class CTI
class CTIFoo extends CTI {} class CTIFoo extends CTI {}
class CTIBar extends CTI {} class CTIBar extends CTI {}
class CTIBaz extends CTI {} class CTIBaz extends CTI {}
class XMLSLC
{
public $foo;
}
class XMLSLCFoo
{
public $id;
}

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\ORM\Mapping\XMLSLC">
<cache usage="NONSTRICT_READ_WRITE" />
<id name="foo" association-key="true"/>
<many-to-one field="foo" target-entity="Doctrine\Tests\ORM\Mapping\XMLSLCFoo">
<join-column name="foo_id" referenced-column-name="id" />
</many-to-one>
</entity>
</doctrine-mapping>