@@ 95-106 (lines=12) @@ | ||
92 | new SimpleCacheAdapter($doctrineCache); |
|
93 | } |
|
94 | ||
95 | public function testGetProxiesToDoctrineFetch() |
|
96 | { |
|
97 | $key = uniqid('key', true); |
|
98 | $value = uniqid('value', true); |
|
99 | ||
100 | /** @var FullyImplementedCache|\PHPUnit_Framework_MockObject_MockObject $doctrineCache */ |
|
101 | $doctrineCache = $this->createMock(FullyImplementedCache::class); |
|
102 | $doctrineCache->expects(self::once())->method('fetch')->with($key)->willReturn($value); |
|
103 | ||
104 | $psrCache = new SimpleCacheAdapter($doctrineCache); |
|
105 | self::assertSame($value, $psrCache->get($key)); |
|
106 | } |
|
107 | ||
108 | public function testGetWithNotExistingKey() |
|
109 | { |
|
@@ 253-265 (lines=13) @@ | ||
250 | * @param mixed $key |
|
251 | * @dataProvider validKeys |
|
252 | */ |
|
253 | public function testGetMultipleAcceptsTraversable($key) |
|
254 | { |
|
255 | $values = [ |
|
256 | $key => uniqid('value', true), |
|
257 | ]; |
|
258 | ||
259 | /** @var FullyImplementedCache|\PHPUnit_Framework_MockObject_MockObject $doctrineCache */ |
|
260 | $doctrineCache = $this->createMock(FullyImplementedCache::class); |
|
261 | $doctrineCache->expects(self::once())->method('fetchMultiple')->with(array_keys($values))->willReturn($values); |
|
262 | ||
263 | $psrCache = new SimpleCacheAdapter($doctrineCache); |
|
264 | $psrCache->getMultiple(new \ArrayObject(array_keys($values))); |
|
265 | } |
|
266 | ||
267 | public function testGetMultipleThrowsExceptionWhenNotArrayOrTraversable() |
|
268 | { |