@@ 79-90 (lines=12) @@ | ||
76 | new SimpleCacheAdapter($doctrineCache); |
|
77 | } |
|
78 | ||
79 | public function testGetProxiesToDoctrineFetch() |
|
80 | { |
|
81 | $key = uniqid('key', true); |
|
82 | $value = uniqid('value', true); |
|
83 | ||
84 | /** @var FullyImplementedCache|\PHPUnit_Framework_MockObject_MockObject $doctrineCache */ |
|
85 | $doctrineCache = $this->createMock(FullyImplementedCache::class); |
|
86 | $doctrineCache->expects(self::once())->method('fetch')->with($key)->willReturn($value); |
|
87 | ||
88 | $psrCache = new SimpleCacheAdapter($doctrineCache); |
|
89 | self::assertSame($value, $psrCache->get($key)); |
|
90 | } |
|
91 | ||
92 | public function testGetWithNotExistingKey() |
|
93 | { |
|
@@ 194-206 (lines=13) @@ | ||
191 | * @param mixed $key |
|
192 | * @dataProvider validKeys |
|
193 | */ |
|
194 | public function testGetMultipleAcceptsTraversable($key) |
|
195 | { |
|
196 | $values = [ |
|
197 | $key => uniqid('value', true), |
|
198 | ]; |
|
199 | ||
200 | /** @var FullyImplementedCache|\PHPUnit_Framework_MockObject_MockObject $doctrineCache */ |
|
201 | $doctrineCache = $this->createMock(FullyImplementedCache::class); |
|
202 | $doctrineCache->expects(self::once())->method('fetchMultiple')->with(array_keys($values))->willReturn($values); |
|
203 | ||
204 | $psrCache = new SimpleCacheAdapter($doctrineCache); |
|
205 | $psrCache->getMultiple(new \ArrayObject(array_keys($values))); |
|
206 | } |
|
207 | ||
208 | public function testGetMultipleThrowsExceptionWhenNotArrayOrTraversable() |
|
209 | { |