[DoctrineBridge] Fixed an issue with DoctrineParserCache

This commit is contained in:
florianv 2014-01-01 09:56:51 +01:00
parent e0402bae65
commit 16728f7b9b
2 changed files with 18 additions and 1 deletions

View File

@ -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;
}
/**

View File

@ -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');