|
@@ 379-410 (lines=32) @@
|
| 376 |
|
$cacheManager->remove($expectedPath, array($expectedFilterOne, $expectedFilterTwo)); |
| 377 |
|
} |
| 378 |
|
|
| 379 |
|
public function testRemoveCacheForSomePathsAndFilterOnRemove() |
| 380 |
|
{ |
| 381 |
|
$expectedPathOne = 'thePathOne'; |
| 382 |
|
$expectedPathTwo = 'thePathTwo'; |
| 383 |
|
$expectedFilter = 'theFilter'; |
| 384 |
|
|
| 385 |
|
$resolver = $this->createResolverMock(); |
| 386 |
|
$resolver |
| 387 |
|
->expects($this->once()) |
| 388 |
|
->method('remove') |
| 389 |
|
->with( |
| 390 |
|
array($expectedPathOne, $expectedPathTwo), |
| 391 |
|
array($expectedFilter) |
| 392 |
|
) |
| 393 |
|
; |
| 394 |
|
|
| 395 |
|
$config = $this->createFilterConfigurationMock(); |
| 396 |
|
$config |
| 397 |
|
->expects($this->atLeastOnce()) |
| 398 |
|
->method('get') |
| 399 |
|
->will($this->returnCallback(function ($filter) { |
| 400 |
|
return array( |
| 401 |
|
'cache' => $filter, |
| 402 |
|
); |
| 403 |
|
})) |
| 404 |
|
; |
| 405 |
|
|
| 406 |
|
$cacheManager = new CacheManager($config, $this->createRouterMock(), new Signer('secret'), $this->createEventDispatcherMock()); |
| 407 |
|
$cacheManager->addResolver($expectedFilter, $resolver); |
| 408 |
|
|
| 409 |
|
$cacheManager->remove(array($expectedPathOne, $expectedPathTwo), $expectedFilter); |
| 410 |
|
} |
| 411 |
|
|
| 412 |
|
public function testRemoveCacheForSomePathsAndSomeFiltersOnRemove() |
| 413 |
|
{ |
|
@@ 545-573 (lines=29) @@
|
| 542 |
|
$cacheManager->remove($expectedPath); |
| 543 |
|
} |
| 544 |
|
|
| 545 |
|
public function testAggregateFiltersByResolverOnRemove() |
| 546 |
|
{ |
| 547 |
|
$expectedFilterOne = 'theFilterOne'; |
| 548 |
|
$expectedFilterTwo = 'theFilterTwo'; |
| 549 |
|
|
| 550 |
|
$resolver = $this->createResolverMock(); |
| 551 |
|
$resolver |
| 552 |
|
->expects($this->once()) |
| 553 |
|
->method('remove') |
| 554 |
|
->with(array(), array($expectedFilterOne, $expectedFilterTwo)) |
| 555 |
|
; |
| 556 |
|
|
| 557 |
|
$config = $this->createFilterConfigurationMock(); |
| 558 |
|
$config |
| 559 |
|
->expects($this->atLeastOnce()) |
| 560 |
|
->method('get') |
| 561 |
|
->will($this->returnCallback(function ($filter) { |
| 562 |
|
return array( |
| 563 |
|
'cache' => $filter, |
| 564 |
|
); |
| 565 |
|
})) |
| 566 |
|
; |
| 567 |
|
|
| 568 |
|
$cacheManager = new CacheManager($config, $this->createRouterMock(), new Signer('secret'), $this->createEventDispatcherMock()); |
| 569 |
|
$cacheManager->addResolver($expectedFilterOne, $resolver); |
| 570 |
|
$cacheManager->addResolver($expectedFilterTwo, $resolver); |
| 571 |
|
|
| 572 |
|
$cacheManager->remove(null, array($expectedFilterOne, $expectedFilterTwo)); |
| 573 |
|
} |
| 574 |
|
|
| 575 |
|
public function testShouldDispatchCachePreResolveEvent() |
| 576 |
|
{ |