|
@@ 192-200 (lines=9) @@
|
| 189 |
|
* |
| 190 |
|
* @return void |
| 191 |
|
*/ |
| 192 |
|
public function deleteMongoException() |
| 193 |
|
{ |
| 194 |
|
$mockCollection = $this->getMockBuilder( |
| 195 |
|
'\\MongoDB\\Collection' |
| 196 |
|
)->disableOriginalConstructor()->getMock(); |
| 197 |
|
$mockCollection->method('deleteOne')->will($this->throwException(new \Exception())); |
| 198 |
|
$cache = new MongoCache($mockCollection, $this->getSerializer()); |
| 199 |
|
$this->assertFalse($cache->delete('key')); |
| 200 |
|
} |
| 201 |
|
|
| 202 |
|
/** |
| 203 |
|
* Verify basic behavior of clear(). |
|
@@ 233-241 (lines=9) @@
|
| 230 |
|
* |
| 231 |
|
* @return void |
| 232 |
|
*/ |
| 233 |
|
public function clearMongoException() |
| 234 |
|
{ |
| 235 |
|
$mockCollection = $this->getMockBuilder( |
| 236 |
|
'\\MongoDB\\Collection' |
| 237 |
|
)->disableOriginalConstructor()->getMock(); |
| 238 |
|
$mockCollection->method('deleteMany')->will($this->throwException(new \Exception())); |
| 239 |
|
$cache = new MongoCache($mockCollection, $this->getSerializer()); |
| 240 |
|
$this->assertFalse($cache->clear()); |
| 241 |
|
} |
| 242 |
|
|
| 243 |
|
/** |
| 244 |
|
* Verify basic behavior of getMultiple |
|
@@ 356-364 (lines=9) @@
|
| 353 |
|
* |
| 354 |
|
* @return void |
| 355 |
|
*/ |
| 356 |
|
public function deleteMultipleMongoException() |
| 357 |
|
{ |
| 358 |
|
$mockCollection = $this->getMockBuilder( |
| 359 |
|
'\\MongoDB\\Collection' |
| 360 |
|
)->disableOriginalConstructor()->getMock(); |
| 361 |
|
$mockCollection->method('deleteMany')->will($this->throwException(new \Exception())); |
| 362 |
|
$cache = new MongoCache($mockCollection, $this->getSerializer()); |
| 363 |
|
$this->assertFalse($cache->deleteMultiple(['key1', 'key3'])); |
| 364 |
|
} |
| 365 |
|
|
| 366 |
|
/** |
| 367 |
|
* Verify basic behavior of has(). |