Skip to content

Commit

Permalink
[DoctrineBridge] Fixed an issue with DoctrineParserCache
Browse files Browse the repository at this point in the history
  • Loading branch information
florianv committed Jan 1, 2014
1 parent e0402ba commit 16728f7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Expand Up @@ -35,7 +35,11 @@ public function __construct(Cache $cache)
*/
public function fetch($key)
{
return $this->cache->fetch($key);
if (false === $value = $this->cache->fetch($key)) {
return null;
}

return $value;
}

/**
Expand Down
Expand Up @@ -29,6 +29,19 @@ public function testFetch()
$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');
Expand Down

0 comments on commit 16728f7

Please sign in to comment.