[Config] Fix checking cache for non existing meta file
This commit is contained in:
parent
04595dc707
commit
17f02e0dc4
@ -72,11 +72,6 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
|
||||
return true; // shortcut - if we don't have any checkers we don't need to bother with the meta file at all
|
||||
}
|
||||
|
||||
$metadata = $this->getMetaFile();
|
||||
if (!is_file($metadata)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$metadata = $this->getMetaFile();
|
||||
if (!is_file($metadata)) {
|
||||
return false;
|
||||
|
@ -128,4 +128,16 @@ class ResourceCheckerConfigCacheTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertSame('FOOBAR', file_get_contents($cache->getPath()));
|
||||
}
|
||||
|
||||
public function testCacheIsNotFreshIfNotExistsMetaFile()
|
||||
{
|
||||
$checker = $this->getMock('\Symfony\Component\Config\ResourceCheckerInterface');
|
||||
$cache = new ResourceCheckerConfigCache($this->cacheFile, array($checker));
|
||||
$cache->write('foo', array(new FileResource(__FILE__)));
|
||||
|
||||
$metaFile = "{$this->cacheFile}.meta";
|
||||
unlink($metaFile);
|
||||
|
||||
$this->assertFalse($cache->isFresh());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user