Merge pull request #6441 from sensorario/remove-loosely-comparison
Verify that the `fileLockRegionDirectory` passed to the `DefaultCacheFactory` cannot be empty
This commit is contained in:
commit
94640aca88
@ -209,7 +209,10 @@ class DefaultCacheFactory implements CacheFactory
|
|||||||
|
|
||||||
if ($cache['usage'] === ClassMetadata::CACHE_USAGE_READ_WRITE) {
|
if ($cache['usage'] === ClassMetadata::CACHE_USAGE_READ_WRITE) {
|
||||||
|
|
||||||
if ( ! $this->fileLockRegionDirectory) {
|
if (
|
||||||
|
'' === $this->fileLockRegionDirectory ||
|
||||||
|
null === $this->fileLockRegionDirectory
|
||||||
|
) {
|
||||||
throw new \LogicException(
|
throw new \LogicException(
|
||||||
'If you want to use a "READ_WRITE" cache an implementation of "Doctrine\ORM\Cache\ConcurrentRegion" is required, ' .
|
'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(). '
|
'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(). '
|
||||||
|
@ -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()
|
public function testBuildsNewNamespacedCacheInstancePerRegionInstance()
|
||||||
{
|
{
|
||||||
$factory = new DefaultCacheFactory($this->regionsConfig, $this->getSharedSecondLevelCacheDriverImpl());
|
$factory = new DefaultCacheFactory($this->regionsConfig, $this->getSharedSecondLevelCacheDriverImpl());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user