From 95fe03b18265cf74248504f3cb9a26e13130cc4b Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Sat, 17 Jan 2015 23:42:15 +0100 Subject: [PATCH] #954 DDC-2982 - Coverage for different instantiation of single-/multi-get cache regions --- .../ORM/Cache/DefaultCacheFactoryTest.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/Doctrine/Tests/ORM/Cache/DefaultCacheFactoryTest.php b/tests/Doctrine/Tests/ORM/Cache/DefaultCacheFactoryTest.php index cb872e520..cd41726d5 100644 --- a/tests/Doctrine/Tests/ORM/Cache/DefaultCacheFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Cache/DefaultCacheFactoryTest.php @@ -281,4 +281,36 @@ class DefaultCacheFactoryTest extends OrmTestCase $this->assertSame('bar', $barRegion->getCache()->getNamespace()); } + public function testBuildsDefaultCacheRegionFromGenericCacheRegion() + { + /* @var $cache \Doctrine\Common\Cache\Cache */ + $cache = $this->getMock('Doctrine\Common\Cache\Cache'); + + $factory = new DefaultCacheFactory($this->regionsConfig, $cache); + + $this->assertInstanceOf( + 'Doctrine\ORM\Cache\Region\DefaultRegion', + $factory->getRegion(array( + 'region' => 'bar', + 'usage' => ClassMetadata::CACHE_USAGE_READ_ONLY, + )) + ); + } + + public function testBuildsMultiGetCacheRegionFromGenericCacheRegion() + { + /* @var $cache \Doctrine\Common\Cache\CacheProvider */ + $cache = $this->getMockForAbstractClass('Doctrine\Common\Cache\CacheProvider'); + + $factory = new DefaultCacheFactory($this->regionsConfig, $cache); + + $this->assertInstanceOf( + 'Doctrine\ORM\Cache\Region\DefaultMultiGetRegion', + $factory->getRegion(array( + 'region' => 'bar', + 'usage' => ClassMetadata::CACHE_USAGE_READ_ONLY, + )) + ); + } + }