8000 [Config] Fix checking cache for non existing meta file · symfony/symfony@0159462 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0159462

Browse files
committed
[Config] Fix checking cache for non existing meta file
1 parent 04595dc commit 0159462

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/Symfony/Component/Config/ResourceCheckerConfigCache.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ public function isFresh()
7272
return true; // shortcut - if we don't have any checkers we don't need to bother with the meta file at all
7373
}
7474

75-
$metadata = $this->getMetaFile();
76-
if (!is_file($metadata)) {
77-
return true;
78-
}
79-
8075
$metadata = $this->getMetaFile();
8176
if (!is_file($metadata)) {
8277
return false;

src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,16 @@ public function testCacheKeepsContent()
128128

129129
$this->assertSame('FOOBAR', file_get_contents($cache->getPath()));
130130
}
131+
132+
public function testCacheIsNotFreshIfNotExistMetaFile()
133+
{
134+
$checker = $this->getMock('\Symfony\Component\Config\ResourceCheckerInterface');
135+
$cache = new ResourceCheckerConfigCache($this->cacheFile, array($checker));
136+
$cache->write('foo', array(new FileResource(__FILE__)));
137+
138+
$metaFile = "{$this->cacheFile}.meta";
139+
unlink($metaFile);
140+
141+
$this->assertFalse($cache->isFresh());
142+
}
131143
}

0 commit comments

Comments
 (0)
0