| @@ 226-253 (lines=28) @@ | ||
| 223 | /** |
|
| 224 | * @covers \eZ\Publish\Core\Persistence\Cache\ContentLanguageHandler::loadByLanguageCode |
|
| 225 | */ |
|
| 226 | public function testLoadByLanguageCode() |
|
| 227 | { |
|
| 228 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 229 | $this->cacheMock |
|
| 230 | ->expects($this->never()) |
|
| 231 | ->method($this->anything()); |
|
| 232 | ||
| 233 | $innerHandler = $this->createMock(Handler::class); |
|
| 234 | $this->persistenceHandlerMock |
|
| 235 | ->expects($this->once()) |
|
| 236 | ->method('contentLanguageHandler') |
|
| 237 | ->will($this->returnValue($innerHandler)); |
|
| 238 | ||
| 239 | $innerHandler |
|
| 240 | ->expects($this->once()) |
|
| 241 | ->method('loadByLanguageCode') |
|
| 242 | ->with('eng-GB') |
|
| 243 | ->will( |
|
| 244 | $this->returnValue( |
|
| 245 | new SPILanguage( |
|
| 246 | array('id' => 2, 'name' => 'English (UK)', 'languageCode' => 'eng-GB') |
|
| 247 | ) |
|
| 248 | ) |
|
| 249 | ); |
|
| 250 | ||
| 251 | $handler = $this->persistenceCacheHandler->contentLanguageHandler(); |
|
| 252 | $handler->loadByLanguageCode('eng-GB'); |
|
| 253 | } |
|
| 254 | ||
| 255 | /** |
|
| 256 | * @covers \eZ\Publish\Core\Persistence\Cache\ContentLanguageHandler::update |
|
| @@ 322-349 (lines=28) @@ | ||
| 319 | /** |
|
| 320 | * @covers \eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::load |
|
| 321 | */ |
|
| 322 | public function testLoadDraft() |
|
| 323 | { |
|
| 324 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 325 | $this->cacheMock |
|
| 326 | ->expects($this->never()) |
|
| 327 | ->method($this->anything()); |
|
| 328 | ||
| 329 | $innerHandlerMock = $this->getContentTypeHandlerMock(); |
|
| 330 | $this->persistenceHandlerMock |
|
| 331 | ->expects($this->once()) |
|
| 332 | ->method('contentTypeHandler') |
|
| 333 | ->will($this->returnValue($innerHandlerMock)); |
|
| 334 | ||
| 335 | $innerHandlerMock |
|
| 336 | ->expects($this->once()) |
|
| 337 | ->method('load') |
|
| 338 | ->with(55) |
|
| 339 | ->will( |
|
| 340 | $this->returnValue( |
|
| 341 | new SPIType( |
|
| 342 | array('id' => 55, 'name' => 'Forum', 'identifier' => 'forum') |
|
| 343 | ) |
|
| 344 | ) |
|
| 345 | ); |
|
| 346 | ||
| 347 | $handler = $this->persistenceCacheHandler->contentTypeHandler(); |
|
| 348 | $handler->load(55, SPIType::STATUS_DRAFT); |
|
| 349 | } |
|
| 350 | ||
| 351 | /** |
|
| 352 | * @covers \eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::load |
|
| @@ 345-372 (lines=28) @@ | ||
| 342 | /** |
|
| 343 | * @covers \eZ\Publish\Core\Persistence\Cache\SectionHandler::loadByIdentifier |
|
| 344 | */ |
|
| 345 | public function testLoadByIdentifier() |
|
| 346 | { |
|
| 347 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 348 | $this->cacheMock |
|
| 349 | ->expects($this->never()) |
|
| 350 | ->method($this->anything()); |
|
| 351 | ||
| 352 | $innerHandler = $this->getSPISectionHandlerMock(); |
|
| 353 | $this->persistenceHandlerMock |
|
| 354 | ->expects($this->once()) |
|
| 355 | ->method('sectionHandler') |
|
| 356 | ->will($this->returnValue($innerHandler)); |
|
| 357 | ||
| 358 | $innerHandler |
|
| 359 | ->expects($this->once()) |
|
| 360 | ->method('loadByIdentifier') |
|
| 361 | ->with('intranet') |
|
| 362 | ->will( |
|
| 363 | $this->returnValue( |
|
| 364 | new SPISection( |
|
| 365 | array('id' => 33, 'name' => 'Intranet', 'identifier' => 'intranet') |
|
| 366 | ) |
|
| 367 | ) |
|
| 368 | ); |
|
| 369 | ||
| 370 | $handler = $this->persistenceCacheHandler->sectionHandler(); |
|
| 371 | $handler->loadByIdentifier('intranet'); |
|
| 372 | } |
|
| 373 | ||
| 374 | /** |
|
| 375 | * @covers \eZ\Publish\Core\Persistence\Cache\SectionHandler::update |
|