| @@ 230-275 (lines=46) @@ | ||
| 227 | /** |
|
| 228 | * @covers \eZ\Publish\Core\Persistence\Cache\LocationHandler::loadParentLocationsForDraftContent |
|
| 229 | */ |
|
| 230 | public function testLoadParentLocationsForDraftContentIsMiss() |
|
| 231 | { |
|
| 232 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 233 | $cacheItemMock = $this->getCacheItemMock(); |
|
| 234 | $this->cacheMock |
|
| 235 | ->expects($this->once()) |
|
| 236 | ->method('getItem') |
|
| 237 | ->with('content', 'locations', '44', 'parentLocationsForDraftContent') |
|
| 238 | ->will($this->returnValue($cacheItemMock)); |
|
| 239 | ||
| 240 | $cacheItemMock |
|
| 241 | ->expects($this->once()) |
|
| 242 | ->method('get') |
|
| 243 | ->will($this->returnValue(null)); |
|
| 244 | ||
| 245 | $cacheItemMock |
|
| 246 | ->expects($this->once()) |
|
| 247 | ->method('isMiss') |
|
| 248 | ->will($this->returnValue(true)); |
|
| 249 | ||
| 250 | $innerHandlerMock = $this->getSPILocationHandlerMock(); |
|
| 251 | $this->persistenceHandlerMock |
|
| 252 | ->expects($this->once()) |
|
| 253 | ->method('locationHandler') |
|
| 254 | ->will($this->returnValue($innerHandlerMock)); |
|
| 255 | ||
| 256 | $innerHandlerMock |
|
| 257 | ->expects($this->once()) |
|
| 258 | ->method('loadParentLocationsForDraftContent') |
|
| 259 | ->with(44) |
|
| 260 | ->will($this->returnValue([new Location(['id' => 33])])); |
|
| 261 | ||
| 262 | $cacheItemMock |
|
| 263 | ->expects($this->once()) |
|
| 264 | ->method('set') |
|
| 265 | ->with([33]) |
|
| 266 | ->will($this->returnValue($cacheItemMock)); |
|
| 267 | ||
| 268 | $cacheItemMock |
|
| 269 | ->expects($this->once()) |
|
| 270 | ->method('save') |
|
| 271 | ->with(); |
|
| 272 | ||
| 273 | $handler = $this->persistenceCacheHandler->locationHandler(); |
|
| 274 | $handler->loadParentLocationsForDraftContent(44); |
|
| 275 | } |
|
| 276 | ||
| 277 | /** |
|
| 278 | * @covers \eZ\Publish\Core\Persistence\Cache\LocationHandler::loadParentLocationsForDraftContent |
|
| @@ 338-383 (lines=46) @@ | ||
| 335 | /** |
|
| 336 | * @covers \eZ\Publish\Core\Persistence\Cache\LocationHandler::loadLocationsByContent |
|
| 337 | */ |
|
| 338 | public function testLoadLocationsByContentWithRootIsMiss() |
|
| 339 | { |
|
| 340 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 341 | $cacheItemMock = $this->getCacheItemMock(); |
|
| 342 | $this->cacheMock |
|
| 343 | ->expects($this->once()) |
|
| 344 | ->method('getItem') |
|
| 345 | ->with('content', 'locations', '44', 'root', '2') |
|
| 346 | ->will($this->returnValue($cacheItemMock)); |
|
| 347 | ||
| 348 | $cacheItemMock |
|
| 349 | ->expects($this->once()) |
|
| 350 | ->method('get') |
|
| 351 | ->will($this->returnValue(null)); |
|
| 352 | ||
| 353 | $cacheItemMock |
|
| 354 | ->expects($this->once()) |
|
| 355 | ->method('isMiss') |
|
| 356 | ->will($this->returnValue(true)); |
|
| 357 | ||
| 358 | $innerHandlerMock = $this->getSPILocationHandlerMock(); |
|
| 359 | $this->persistenceHandlerMock |
|
| 360 | ->expects($this->once()) |
|
| 361 | ->method('locationHandler') |
|
| 362 | ->will($this->returnValue($innerHandlerMock)); |
|
| 363 | ||
| 364 | $innerHandlerMock |
|
| 365 | ->expects($this->once()) |
|
| 366 | ->method('loadLocationsByContent') |
|
| 367 | ->with(44, 2) |
|
| 368 | ->will($this->returnValue([new Location(['id' => 33])])); |
|
| 369 | ||
| 370 | $cacheItemMock |
|
| 371 | ->expects($this->once()) |
|
| 372 | ->method('set') |
|
| 373 | ->with([33]) |
|
| 374 | ->will($this->returnValue($cacheItemMock)); |
|
| 375 | ||
| 376 | $cacheItemMock |
|
| 377 | ->expects($this->once()) |
|
| 378 | ->method('save') |
|
| 379 | ->with(); |
|
| 380 | ||
| 381 | $handler = $this->persistenceCacheHandler->locationHandler(); |
|
| 382 | $handler->loadLocationsByContent(44, 2); |
|
| 383 | } |
|
| 384 | ||
| 385 | /** |
|
| 386 | * @covers \eZ\Publish\Core\Persistence\Cache\LocationHandler::loadLocationsByContent |
|