1
0
mirror of synced 2025-03-21 07:23:55 +03:00

Each cache region built by the DefaultCacheFactory should have its own cache with its own unique namespace

This commit is contained in:
Marco Pivetta 2015-01-15 21:15:38 +01:00
parent 514fd008b9
commit a82eecfc07

View File

@ -257,11 +257,28 @@ class DefaultCacheFactoryTest extends OrmTestCase
*/
public function testInvalidFileLockRegionDirectoryException()
{
$factory = new \Doctrine\ORM\Cache\DefaultCacheFactory($this->regionsConfig, $this->getSharedSecondLevelCacheDriverImpl());
$factory = new DefaultCacheFactory($this->regionsConfig, $this->getSharedSecondLevelCacheDriverImpl());
$factory->getRegion(array(
'usage' => ClassMetadata::CACHE_USAGE_READ_WRITE,
'region' => 'foo'
));
}
public function testBuildsNewNamespacedCacheInstancePerRegionInstance()
{
$factory = new DefaultCacheFactory($this->regionsConfig, $this->getSharedSecondLevelCacheDriverImpl());
$fooRegion = $factory->getRegion(array(
'region' => 'foo',
'usage' => ClassMetadata::CACHE_USAGE_READ_ONLY,
));
$barRegion = $factory->getRegion(array(
'region' => 'foo',
'usage' => ClassMetadata::CACHE_USAGE_READ_ONLY,
));
$this->assertSame('foo', $fooRegion->getCache()->getNamespace());
$this->assertSame('bar', $barRegion->getCache()->getNamespace());
}
}