From 5f2922b3a7b6f0d8e5df363952a2218ba9f465ff Mon Sep 17 00:00:00 2001 From: Asmir Mustafic Date: Sat, 20 Jun 2015 14:24:01 +0200 Subject: [PATCH] Test annotation driver with failing SLC mapping --- .../ORM/Mapping/AnnotationDriverTest.php | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php index 927755f99..409dec663 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php @@ -23,6 +23,19 @@ class AnnotationDriverTest extends AbstractMappingDriverTest $annotationDriver->loadMetadataForClass('stdClass', $cm); } + /** + * @expectedException Doctrine\ORM\Cache\CacheException + * @expectedExceptionMessage Entity association field "Doctrine\Tests\ORM\Mapping\AnnotationSLC#foo" not configured as part of the second-level cache. + */ + public function testFailingSecondLevelCacheAssociation() + { + $className = 'Doctrine\Tests\ORM\Mapping\AnnotationSLC'; + $mappingDriver = $this->_loadDriver(); + + $class = new ClassMetadata($className); + $mappingDriver->loadMetadataForClass($className, $class); + } + /** * @group DDC-268 */ @@ -351,3 +364,26 @@ class InvalidFetchOption */ private $collection; } + +/** + * @Entity + * @Cache + */ +class AnnotationSLC +{ + /** + * @Id + * @ManyToOne(targetEntity="AnnotationSLCFoo") + */ + public $foo; +} +/** + * @Entity + */ +class AnnotationSLCFoo +{ + /** + * @Column(type="string") + */ + public $id; +}