File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
src/Symfony/Bridge/Doctrine Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,11 @@ public function __construct(Cache $cache)
35
35
*/
36
36
public function fetch ($ key )
37
37
{
38
- return $ this ->cache ->fetch ($ key );
38
+ if (false === $ value = $ this ->cache ->fetch ($ key )) {
39
+ return null ;
40
+ }
41
+
42
+ return $ value ;
39
43
}
40
44
41
45
/**
Original file line number Diff line number Diff line change @@ -29,6 +29,19 @@ public function testFetch()
29
29
$ this ->assertEquals ('bar ' , $ result );
30
30
}
31
31
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
+
32
45
public function testSave ()
33
46
{
34
47
$ doctrineCacheMock = $ this ->getMock ('Doctrine\Common\Cache\Cache ' );
2CCF
You can’t perform that action at this time.
0 commit comments