Code Duplication    Length = 37-37 lines in 2 locations

eZ/Publish/Core/Persistence/Cache/Tests/ContentHandlerTest.php 2 locations

@@ 394-430 (lines=37) @@
391
    /**
392
     * @covers \eZ\Publish\Core\Persistence\Cache\ContentHandler::setStatus
393
     */
394
    public function testSetStatus()
395
    {
396
        $this->loggerMock->expects($this->once())->method('logCall');
397
398
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Handler');
399
        $this->persistenceHandlerMock
400
            ->expects($this->once())
401
            ->method('contentHandler')
402
            ->will($this->returnValue($innerHandlerMock));
403
404
        $innerHandlerMock
405
            ->expects($this->once())
406
            ->method('setStatus')
407
            ->with(2, VersionInfo::STATUS_ARCHIVED, 1)
408
            ->will($this->returnValue(true));
409
410
        $this->cacheMock
411
            ->expects($this->at(0))
412
            ->method('clear')
413
            ->with('content', 2, 1)
414
            ->will($this->returnValue(null));
415
416
        $this->cacheMock
417
            ->expects($this->at(1))
418
            ->method('clear')
419
            ->with('content', 2, ContentHandler::PUBLISHED_VERSION)
420
            ->will($this->returnValue(null));
421
422
        $this->cacheMock
423
            ->expects($this->at(2))
424
            ->method('clear')
425
            ->with('content', 'info', 2, 'versioninfo', 1)
426
            ->will($this->returnValue(null));
427
428
        $handler = $this->persistenceCacheHandler->contentHandler();
429
        $handler->setStatus(2, VersionInfo::STATUS_ARCHIVED, 1);
430
    }
431
432
    /**
433
     * @covers \eZ\Publish\Core\Persistence\Cache\ContentHandler::setStatus
@@ 435-471 (lines=37) @@
432
    /**
433
     * @covers \eZ\Publish\Core\Persistence\Cache\ContentHandler::setStatus
434
     */
435
    public function testSetStatusPublished()
436
    {
437
        $this->loggerMock->expects($this->once())->method('logCall');
438
439
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Handler');
440
        $this->persistenceHandlerMock
441
            ->expects($this->once())
442
            ->method('contentHandler')
443
            ->will($this->returnValue($innerHandlerMock));
444
445
        $innerHandlerMock
446
            ->expects($this->once())
447
            ->method('setStatus')
448
            ->with(2, VersionInfo::STATUS_PUBLISHED, 1)
449
            ->will($this->returnValue(true));
450
451
        $this->cacheMock
452
            ->expects($this->at(0))
453
            ->method('clear')
454
            ->with('content', 2, 1)
455
            ->will($this->returnValue(null));
456
457
        $this->cacheMock
458
            ->expects($this->at(1))
459
            ->method('clear')
460
            ->with('content', 2, ContentHandler::PUBLISHED_VERSION)
461
            ->will($this->returnValue(null));
462
463
        $this->cacheMock
464
            ->expects($this->at(2))
465
            ->method('clear')
466
            ->with('content', 'info', 2)
467
            ->will($this->returnValue(null));
468
469
        $handler = $this->persistenceCacheHandler->contentHandler();
470
        $handler->setStatus(2, VersionInfo::STATUS_PUBLISHED, 1);
471
    }
472
473
    /**
474
     * @covers \eZ\Publish\Core\Persistence\Cache\ContentHandler::updateMetadata