|
@@ 194-203 (lines=10) @@
|
| 191 |
|
* |
| 192 |
|
* @return void |
| 193 |
|
*/ |
| 194 |
|
public function deleteMongoException() |
| 195 |
|
{ |
| 196 |
|
$mockCollection = $this->getMockBuilder( |
| 197 |
|
'\\MongoDB\\Collection', |
| 198 |
|
['deleteOne', 'createIndex'] |
| 199 |
|
)->disableOriginalConstructor()->getMock(); |
| 200 |
|
$mockCollection->method('deleteOne')->will($this->throwException(new \Exception())); |
| 201 |
|
$cache = new MongoCache($mockCollection, $this->getSerializer()); |
| 202 |
|
$this->assertFalse($cache->delete('key')); |
| 203 |
|
} |
| 204 |
|
|
| 205 |
|
/** |
| 206 |
|
* Verify basic behavior of clear(). |
|
@@ 236-245 (lines=10) @@
|
| 233 |
|
* |
| 234 |
|
* @return void |
| 235 |
|
*/ |
| 236 |
|
public function clearMongoException() |
| 237 |
|
{ |
| 238 |
|
$mockCollection = $this->getMockBuilder( |
| 239 |
|
'\\MongoDB\\Collection', |
| 240 |
|
['deleteMany', 'createIndex'] |
| 241 |
|
)->disableOriginalConstructor()->getMock(); |
| 242 |
|
$mockCollection->method('deleteMany')->will($this->throwException(new \Exception())); |
| 243 |
|
$cache = new MongoCache($mockCollection, $this->getSerializer()); |
| 244 |
|
$this->assertFalse($cache->clear()); |
| 245 |
|
} |
| 246 |
|
|
| 247 |
|
/** |
| 248 |
|
* Verify basic behavior of getMultiple |
|
@@ 361-370 (lines=10) @@
|
| 358 |
|
* |
| 359 |
|
* @return void |
| 360 |
|
*/ |
| 361 |
|
public function deleteMultipleMongoException() |
| 362 |
|
{ |
| 363 |
|
$mockCollection = $this->getMockBuilder( |
| 364 |
|
'\\MongoDB\\Collection', |
| 365 |
|
['deleteMany', 'createIndex'] |
| 366 |
|
)->disableOriginalConstructor()->getMock(); |
| 367 |
|
$mockCollection->method('deleteMany')->will($this->throwException(new \Exception())); |
| 368 |
|
$cache = new MongoCache($mockCollection, $this->getSerializer()); |
| 369 |
|
$this->assertFalse($cache->deleteMultiple(['key1', 'key3'])); |
| 370 |
|
} |
| 371 |
|
|
| 372 |
|
/** |
| 373 |
|
* Verify basic behavior of has(). |