Code Duplication    Length = 25-26 lines in 3 locations

eZ/Publish/Core/Persistence/Cache/Tests/ContentHandlerTest.php 1 location

@@ 301-325 (lines=25) @@
298
    /**
299
     * @covers eZ\Publish\Core\Persistence\Cache\ContentHandler::setStatus
300
     */
301
    public function testSetStatus()
302
    {
303
        $this->loggerMock->expects($this->once())->method('logCall');
304
305
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Handler');
306
        $this->persistenceHandlerMock
307
            ->expects($this->once())
308
            ->method('contentHandler')
309
            ->will($this->returnValue($innerHandlerMock));
310
311
        $innerHandlerMock
312
            ->expects($this->once())
313
            ->method('setStatus')
314
            ->with(2, VersionInfo::STATUS_ARCHIVED, 1)
315
            ->will($this->returnValue(true));
316
317
        $this->cacheMock
318
            ->expects($this->once())
319
            ->method('clear')
320
            ->with('content', 2, 1)
321
            ->will($this->returnValue(null));
322
323
        $handler = $this->persistenceCacheHandler->contentHandler();
324
        $handler->setStatus(2, VersionInfo::STATUS_ARCHIVED, 1);
325
    }
326
327
    /**
328
     * @covers eZ\Publish\Core\Persistence\Cache\ContentHandler::setStatus

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

@@ 950-975 (lines=26) @@
947
    /**
948
     * @covers eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::link
949
     */
950
    public function testLink()
951
    {
952
        $this->loggerMock->expects($this->once())->method('logCall');
953
        $this->cacheMock
954
            ->expects($this->at(0))
955
            ->method('clear')
956
            ->with('contentType', 44)
957
            ->will($this->returnValue(true));
958
959
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Type\\Handler');
960
        $this->persistenceHandlerMock
961
            ->expects($this->once())
962
            ->method('contentTypeHandler')
963
            ->will($this->returnValue($innerHandlerMock));
964
965
        $innerHandlerMock
966
            ->expects($this->once())
967
            ->method('link')
968
            ->with(22, 44, SPIType::STATUS_DEFINED)
969
            ->will(
970
                $this->returnValue(true)
971
            );
972
973
        $handler = $this->persistenceCacheHandler->contentTypeHandler();
974
        $handler->link(22, 44, SPIType::STATUS_DEFINED);
975
    }
976
977
    /**
978
     * @covers eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::link
@@ 1008-1033 (lines=26) @@
1005
    /**
1006
     * @covers eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::unlink
1007
     */
1008
    public function testUnlink()
1009
    {
1010
        $this->loggerMock->expects($this->once())->method('logCall');
1011
        $this->cacheMock
1012
            ->expects($this->at(0))
1013
            ->method('clear')
1014
            ->with('contentType', 44)
1015
            ->will($this->returnValue(true));
1016
1017
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Type\\Handler');
1018
        $this->persistenceHandlerMock
1019
            ->expects($this->once())
1020
            ->method('contentTypeHandler')
1021
            ->will($this->returnValue($innerHandlerMock));
1022
1023
        $innerHandlerMock
1024
            ->expects($this->once())
1025
            ->method('unlink')
1026
            ->with(22, 44, SPIType::STATUS_DEFINED)
1027
            ->will(
1028
                $this->returnValue(true)
1029
            );
1030
1031
        $handler = $this->persistenceCacheHandler->contentTypeHandler();
1032
        $handler->unlink(22, 44, SPIType::STATUS_DEFINED);
1033
    }
1034
1035
    /**
1036
     * @covers eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::unlink