8000 [DoctrineBridge] Fixed an issue with DoctrineParserCache · symfony/symfony@16728f7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 16728f7

Browse files
committed
[DoctrineBridge] Fixed an issue with DoctrineParserCache
1 parent e0402ba commit 16728f7

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/Symfony/Bridge/Doctrine/ExpressionLanguage/DoctrineParserCache.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ public function __construct(Cache $cache)
3535
*/
3636
public function fetch($key)
3737
{
38-
return $this->cache->fetch($key);
38+
if (false === $value = $this->cache->fetch($key)) {
39+
return null;
40+
}
41+
42+
return $value;
3943
}
4044

4145
/**

src/Symfony/Bridge/Doctrine/Tests/ExpressionLanguage/DoctrineParserCacheTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ public function testFetch()
2929
$this->assertEquals('bar', $result);
3030
}
3131

32+
public function testFetchUnexisting()
33+
{
34+
$doctrineCacheMock = $this->getMock('Doctrine\Common\Cache\Cache');
35+
$parserCache = new DoctrineParserCache($doctrineCacheMock);
36+
37+
$doctrineCacheMock
38+
->expects($this->once())
39+
->method('fetch')
40+
->will($this->returnValue(false));
41+
42+
$this->assertNull($parserCache->fetch(''));
43+
}
44+
3245
public function testSave()
3346
{
3447
$doctrineCacheMock = $this->getMock('Doctrine\Common\Cache\Cache');

0 commit comments

Comments
 (0)
0