Code Duplication    Length = 25-26 lines in 3 locations

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

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

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

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