From 4da0ee9db8c3636f056a3b780f78ae419f6069a0 Mon Sep 17 00:00:00 2001 From: Asmir Mustafic Date: Sat, 20 Jun 2015 14:24:19 +0200 Subject: [PATCH] Test PHP driver with failing SLC mapping --- .../Tests/ORM/Mapping/PHPMappingDriverTest.php | 13 +++++++++++++ .../php/Doctrine.Tests.ORM.Mapping.PHPSLC.php | 12 ++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.PHPSLC.php diff --git a/tests/Doctrine/Tests/ORM/Mapping/PHPMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/PHPMappingDriverTest.php index 5d06983ca..142455542 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/PHPMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/PHPMappingDriverTest.php @@ -33,4 +33,17 @@ class PHPMappingDriverTest extends AbstractMappingDriverTest { $this->createClassMetadata('Doctrine\Tests\Models\DDC889\DDC889Class'); } + + /** + * @expectedException Doctrine\ORM\Cache\CacheException + * @expectedExceptionMessage Entity association field "Doctrine\Tests\ORM\Mapping\PHPSLC#foo" not configured as part of the second-level cache. + */ + public function testFailingSecondLevelCacheAssociation() + { + $className = 'Doctrine\Tests\ORM\Mapping\PHPSLC'; + $mappingDriver = $this->_loadDriver(); + + $class = new ClassMetadata($className); + $mappingDriver->loadMetadataForClass($className, $class); + } } diff --git a/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.PHPSLC.php b/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.PHPSLC.php new file mode 100644 index 000000000..c9341958a --- /dev/null +++ b/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.PHPSLC.php @@ -0,0 +1,12 @@ +enableCache(array( + 'usage' => ClassMetadataInfo::CACHE_USAGE_READ_ONLY +)); +$metadata->mapManyToOne(array( + 'fieldName' => 'foo', + 'id' => true, + 'targetEntity' => 'PHPSLCFoo' +)); \ No newline at end of file