| @@ 340-388 (lines=49) @@ | ||
| 337 | /** |
|
| 338 | * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::listURLAliasesForLocation |
|
| 339 | */ |
|
| 340 | public function testListURLAliasesForLocationIsMiss() |
|
| 341 | { |
|
| 342 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 343 | ||
| 344 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 345 | $this->cacheMock |
|
| 346 | ->expects($this->once()) |
|
| 347 | ->method('getItem') |
|
| 348 | ->with('urlAlias', 'location', 44) |
|
| 349 | ->will($this->returnValue($cacheItemMock)); |
|
| 350 | ||
| 351 | $cacheItemMock |
|
| 352 | ->expects($this->once()) |
|
| 353 | ->method('get') |
|
| 354 | ->will($this->returnValue(null)); |
|
| 355 | ||
| 356 | $cacheItemMock |
|
| 357 | ->expects($this->once()) |
|
| 358 | ->method('isMiss') |
|
| 359 | ->will($this->returnValue(true)); |
|
| 360 | ||
| 361 | $innerHandler = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias\\Handler'); |
|
| 362 | $this->persistenceHandlerMock |
|
| 363 | ->expects($this->once()) |
|
| 364 | ->method('urlAliasHandler') |
|
| 365 | ->will($this->returnValue($innerHandler)); |
|
| 366 | ||
| 367 | $innerHandler |
|
| 368 | ->expects($this->once()) |
|
| 369 | ->method('listURLAliasesForLocation') |
|
| 370 | ->with(44, false) |
|
| 371 | ->will( |
|
| 372 | $this->returnValue( |
|
| 373 | array( |
|
| 374 | new UrlAlias(array('id' => 55)), |
|
| 375 | new UrlAlias(array('id' => 58)), |
|
| 376 | new UrlAlias(array('id' => 91)), |
|
| 377 | ) |
|
| 378 | ) |
|
| 379 | ); |
|
| 380 | ||
| 381 | $cacheItemMock |
|
| 382 | ->expects($this->once()) |
|
| 383 | ->method('set') |
|
| 384 | ->with(array(55, 58, 91)); |
|
| 385 | ||
| 386 | $handler = $this->persistenceCacheHandler->urlAliasHandler(); |
|
| 387 | $handler->listURLAliasesForLocation(44, false); |
|
| 388 | } |
|
| 389 | ||
| 390 | /** |
|
| 391 | * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::listURLAliasesForLocation |
|
| @@ 393-441 (lines=49) @@ | ||
| 390 | /** |
|
| 391 | * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::listURLAliasesForLocation |
|
| 392 | */ |
|
| 393 | public function testListURLAliasesForLocationCustomIsMiss() |
|
| 394 | { |
|
| 395 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 396 | ||
| 397 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 398 | $this->cacheMock |
|
| 399 | ->expects($this->once()) |
|
| 400 | ->method('getItem') |
|
| 401 | ->with('urlAlias', 'location', '44', 'custom') |
|
| 402 | ->will($this->returnValue($cacheItemMock)); |
|
| 403 | ||
| 404 | $cacheItemMock |
|
| 405 | ->expects($this->once()) |
|
| 406 | ->method('get') |
|
| 407 | ->will($this->returnValue(null)); |
|
| 408 | ||
| 409 | $cacheItemMock |
|
| 410 | ->expects($this->once()) |
|
| 411 | ->method('isMiss') |
|
| 412 | ->will($this->returnValue(true)); |
|
| 413 | ||
| 414 | $innerHandler = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias\\Handler'); |
|
| 415 | $this->persistenceHandlerMock |
|
| 416 | ->expects($this->once()) |
|
| 417 | ->method('urlAliasHandler') |
|
| 418 | ->will($this->returnValue($innerHandler)); |
|
| 419 | ||
| 420 | $innerHandler |
|
| 421 | ->expects($this->once()) |
|
| 422 | ->method('listURLAliasesForLocation') |
|
| 423 | ->with(44, true) |
|
| 424 | ->will( |
|
| 425 | $this->returnValue( |
|
| 426 | array( |
|
| 427 | new UrlAlias(array('id' => 55)), |
|
| 428 | new UrlAlias(array('id' => 58)), |
|
| 429 | new UrlAlias(array('id' => 91)), |
|
| 430 | ) |
|
| 431 | ) |
|
| 432 | ); |
|
| 433 | ||
| 434 | $cacheItemMock |
|
| 435 | ->expects($this->once()) |
|
| 436 | ->method('set') |
|
| 437 | ->with(array(55, 58, 91)); |
|
| 438 | ||
| 439 | $handler = $this->persistenceCacheHandler->urlAliasHandler(); |
|
| 440 | $handler->listURLAliasesForLocation(44, true); |
|
| 441 | } |
|
| 442 | ||
| 443 | /** |
|
| 444 | * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::listURLAliasesForLocation |
|