| @@ 368-422 (lines=55) @@ | ||
| 365 | /** |
|
| 366 | * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::listURLAliasesForLocation |
|
| 367 | */ |
|
| 368 | public function testListURLAliasesForLocationIsMiss() |
|
| 369 | { |
|
| 370 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 371 | ||
| 372 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 373 | $this->cacheMock |
|
| 374 | ->expects($this->once()) |
|
| 375 | ->method('getItem') |
|
| 376 | ->with('urlAlias', 'location', 44) |
|
| 377 | ->will($this->returnValue($cacheItemMock)); |
|
| 378 | ||
| 379 | $cacheItemMock |
|
| 380 | ->expects($this->once()) |
|
| 381 | ->method('get') |
|
| 382 | ->will($this->returnValue(null)); |
|
| 383 | ||
| 384 | $cacheItemMock |
|
| 385 | ->expects($this->once()) |
|
| 386 | ->method('isMiss') |
|
| 387 | ->will($this->returnValue(true)); |
|
| 388 | ||
| 389 | $innerHandler = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias\\Handler'); |
|
| 390 | $this->persistenceHandlerMock |
|
| 391 | ->expects($this->once()) |
|
| 392 | ->method('urlAliasHandler') |
|
| 393 | ->will($this->returnValue($innerHandler)); |
|
| 394 | ||
| 395 | $innerHandler |
|
| 396 | ->expects($this->once()) |
|
| 397 | ->method('listURLAliasesForLocation') |
|
| 398 | ->with(44, false) |
|
| 399 | ->will( |
|
| 400 | $this->returnValue( |
|
| 401 | array( |
|
| 402 | new UrlAlias(array('id' => 55)), |
|
| 403 | new UrlAlias(array('id' => 58)), |
|
| 404 | new UrlAlias(array('id' => 91)), |
|
| 405 | ) |
|
| 406 | ) |
|
| 407 | ); |
|
| 408 | ||
| 409 | $cacheItemMock |
|
| 410 | ->expects($this->once()) |
|
| 411 | ->method('set') |
|
| 412 | ->with(array(55, 58, 91)) |
|
| 413 | ->will($this->returnValue($cacheItemMock)); |
|
| 414 | ||
| 415 | $cacheItemMock |
|
| 416 | ->expects($this->once()) |
|
| 417 | ->method('save') |
|
| 418 | ->with(); |
|
| 419 | ||
| 420 | $handler = $this->persistenceCacheHandler->urlAliasHandler(); |
|
| 421 | $handler->listURLAliasesForLocation(44, false); |
|
| 422 | } |
|
| 423 | ||
| 424 | /** |
|
| 425 | * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::listURLAliasesForLocation |
|
| @@ 427-481 (lines=55) @@ | ||
| 424 | /** |
|
| 425 | * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::listURLAliasesForLocation |
|
| 426 | */ |
|
| 427 | public function testListURLAliasesForLocationCustomIsMiss() |
|
| 428 | { |
|
| 429 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 430 | ||
| 431 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 432 | $this->cacheMock |
|
| 433 | ->expects($this->once()) |
|
| 434 | ->method('getItem') |
|
| 435 | ->with('urlAlias', 'location', '44', 'custom') |
|
| 436 | ->will($this->returnValue($cacheItemMock)); |
|
| 437 | ||
| 438 | $cacheItemMock |
|
| 439 | ->expects($this->once()) |
|
| 440 | ->method('get') |
|
| 441 | ->will($this->returnValue(null)); |
|
| 442 | ||
| 443 | $cacheItemMock |
|
| 444 | ->expects($this->once()) |
|
| 445 | ->method('isMiss') |
|
| 446 | ->will($this->returnValue(true)); |
|
| 447 | ||
| 448 | $innerHandler = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias\\Handler'); |
|
| 449 | $this->persistenceHandlerMock |
|
| 450 | ->expects($this->once()) |
|
| 451 | ->method('urlAliasHandler') |
|
| 452 | ->will($this->returnValue($innerHandler)); |
|
| 453 | ||
| 454 | $innerHandler |
|
| 455 | ->expects($this->once()) |
|
| 456 | ->method('listURLAliasesForLocation') |
|
| 457 | ->with(44, true) |
|
| 458 | ->will( |
|
| 459 | $this->returnValue( |
|
| 460 | array( |
|
| 461 | new UrlAlias(array('id' => 55)), |
|
| 462 | new UrlAlias(array('id' => 58)), |
|
| 463 | new UrlAlias(array('id' => 91)), |
|
| 464 | ) |
|
| 465 | ) |
|
| 466 | ); |
|
| 467 | ||
| 468 | $cacheItemMock |
|
| 469 | ->expects($this->once()) |
|
| 470 | ->method('set') |
|
| 471 | ->with(array(55, 58, 91)) |
|
| 472 | ->will($this->returnValue($cacheItemMock)); |
|
| 473 | ||
| 474 | $cacheItemMock |
|
| 475 | ->expects($this->once()) |
|
| 476 | ->method('save') |
|
| 477 | ->with(); |
|
| 478 | ||
| 479 | $handler = $this->persistenceCacheHandler->urlAliasHandler(); |
|
| 480 | $handler->listURLAliasesForLocation(44, true); |
|
| 481 | } |
|
| 482 | ||
| 483 | /** |
|
| 484 | * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::listURLAliasesForLocation |
|