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

remove loosely comparison

This commit is contained in:
Simone Gentili 2017-05-15 07:15:26 +02:00
parent 6ea30f0354
commit 4bf2e890fb
2 changed files with 22 additions and 1 deletions

View File

@ -210,7 +210,10 @@ class DefaultCacheFactory implements CacheFactory
if ($cache['usage'] === ClassMetadata::CACHE_USAGE_READ_WRITE) {
if ( ! $this->fileLockRegionDirectory) {
if (
'' === $this->fileLockRegionDirectory ||
null === $this->fileLockRegionDirectory
) {
throw new \LogicException(
'If you want to use a "READ_WRITE" cache an implementation of "Doctrine\ORM\Cache\ConcurrentRegion" is required, ' .
'The default implementation provided by doctrine is "Doctrine\ORM\Cache\Region\FileLockRegion" if you want to use it please provide a valid directory, DefaultCacheFactory#setFileLockRegionDirectory(). '

View File

@ -275,6 +275,24 @@ class DefaultCacheFactoryTest extends OrmTestCase
);
}
/**
* @expectedException LogicException
* @expectedExceptionMessage If you want to use a "READ_WRITE" cache an implementation of "Doctrine\ORM\Cache\ConcurrentRegion" is required, The default implementation provided by doctrine is "Doctrine\ORM\Cache\Region\FileLockRegion" if you want to use it please provide a valid directory
*/
public function testInvalidFileLockRegionDirectoryExceptionWithEmptyString()
{
$factory = new DefaultCacheFactory($this->regionsConfig, $this->getSharedSecondLevelCacheDriverImpl());
$factory->setFileLockRegionDirectory('');
$factory->getRegion(
[
'usage' => ClassMetadata::CACHE_USAGE_READ_WRITE,
'region' => 'foo'
]
);
}
public function testBuildsNewNamespacedCacheInstancePerRegionInstance()
{
$factory = new DefaultCacheFactory($this->regionsConfig, $this->getSharedSecondLevelCacheDriverImpl());