|
@@ 101-118 (lines=18) @@
|
| 98 |
|
$this->assertSame($item, $returnedItem); |
| 99 |
|
} |
| 100 |
|
|
| 101 |
|
public function testGetItems() |
| 102 |
|
{ |
| 103 |
|
$items = [ |
| 104 |
|
'first' => $this->createCacheItem('first'), |
| 105 |
|
'second' => $this->createCacheItem('second'), |
| 106 |
|
]; |
| 107 |
|
|
| 108 |
|
$this->innerPool |
| 109 |
|
->expects($this->once()) |
| 110 |
|
->method('getItems') |
| 111 |
|
->with(['first', 'second']) |
| 112 |
|
->willReturn($items); |
| 113 |
|
|
| 114 |
|
$this->inMemory->expects($this->never())->method($this->anything()); |
| 115 |
|
|
| 116 |
|
$returnedItems = $this->cache->getItems(['first', 'second']); |
| 117 |
|
$this->assertSame($items, $returnedItems); |
| 118 |
|
} |
| 119 |
|
|
| 120 |
|
/** |
| 121 |
|
* Symfony uses generators with getItems() so we need to make sure we handle that. |
|
@@ 123-140 (lines=18) @@
|
| 120 |
|
/** |
| 121 |
|
* Symfony uses generators with getItems() so we need to make sure we handle that. |
| 122 |
|
*/ |
| 123 |
|
public function testGetItemsWithGenerator() |
| 124 |
|
{ |
| 125 |
|
$items = [ |
| 126 |
|
'first' => $this->createCacheItem('first'), |
| 127 |
|
'second' => $this->createCacheItem('second'), |
| 128 |
|
]; |
| 129 |
|
|
| 130 |
|
$this->innerPool |
| 131 |
|
->expects($this->once()) |
| 132 |
|
->method('getItems') |
| 133 |
|
->with(['first', 'second']) |
| 134 |
|
->willReturn($this->arrayAsGenerator($items)); |
| 135 |
|
|
| 136 |
|
$this->inMemory->expects($this->never())->method($this->anything()); |
| 137 |
|
|
| 138 |
|
$returnedItems = iterator_to_array($this->cache->getItems(['first', 'second'])); |
| 139 |
|
$this->assertSame($items, $returnedItems); |
| 140 |
|
} |
| 141 |
|
|
| 142 |
|
public function testHasItem() |
| 143 |
|
{ |