[DoctrineBridge] Fixed an issue with DoctrineParserCache
This commit is contained in:
parent
e0402bae65
commit
16728f7b9b
@ -35,7 +35,11 @@ class DoctrineParserCache implements ParserCacheInterface
|
||||
*/
|
||||
public function fetch($key)
|
||||
{
|
||||
return $this->cache->fetch($key);
|
||||
if (false === $value = $this->cache->fetch($key)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,6 +29,19 @@ class DoctrineParserCacheTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('bar', $result);
|
||||
}
|
||||
|
||||
public function testFetchUnexisting()
|
||||
{
|
||||
$doctrineCacheMock = $this->getMock('Doctrine\Common\Cache\Cache');
|
||||
$parserCache = new DoctrineParserCache($doctrineCacheMock);
|
||||
|
||||
$doctrineCacheMock
|
||||
->expects($this->once())
|
||||
->method('fetch')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$this->assertNull($parserCache->fetch(''));
|
||||
}
|
||||
|
||||
public function testSave()
|
||||
{
|
||||
$doctrineCacheMock = $this->getMock('Doctrine\Common\Cache\Cache');
|
||||
|
Reference in New Issue
Block a user