Code Duplication    Length = 25-26 lines in 3 locations

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

@@ 289-313 (lines=25) @@
286
    /**
287
     * @covers eZ\Publish\Core\Persistence\Cache\ContentHandler::setStatus
288
     */
289
    public function testSetStatus()
290
    {
291
        $this->loggerMock->expects($this->once())->method('logCall');
292
293
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Handler');
294
        $this->persistenceHandlerMock
295
            ->expects($this->once())
296
            ->method('contentHandler')
297
            ->will($this->returnValue($innerHandlerMock));
298
299
        $innerHandlerMock
300
            ->expects($this->once())
301
            ->method('setStatus')
302
            ->with(2, VersionInfo::STATUS_ARCHIVED, 1)
303
            ->will($this->returnValue(true));
304
305
        $this->cacheMock
306
            ->expects($this->once())
307
            ->method('clear')
308
            ->with('content', 2, 1)
309
            ->will($this->returnValue(null));
310
311
        $handler = $this->persistenceCacheHandler->contentHandler();
312
        $handler->setStatus(2, VersionInfo::STATUS_ARCHIVED, 1);
313
    }
314
315
    /**
316
     * @covers eZ\Publish\Core\Persistence\Cache\ContentHandler::setStatus

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

@@ 890-915 (lines=26) @@
887
    /**
888
     * @covers eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::link
889
     */
890
    public function testLink()
891
    {
892
        $this->loggerMock->expects($this->once())->method('logCall');
893
        $this->cacheMock
894
            ->expects($this->at(0))
895
            ->method('clear')
896
            ->with('contentType', 44)
897
            ->will($this->returnValue(true));
898
899
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Type\\Handler');
900
        $this->persistenceHandlerMock
901
            ->expects($this->once())
902
            ->method('contentTypeHandler')
903
            ->will($this->returnValue($innerHandlerMock));
904
905
        $innerHandlerMock
906
            ->expects($this->once())
907
            ->method('link')
908
            ->with(22, 44, SPIType::STATUS_DEFINED)
909
            ->will(
910
                $this->returnValue(true)
911
            );
912
913
        $handler = $this->persistenceCacheHandler->contentTypeHandler();
914
        $handler->link(22, 44, SPIType::STATUS_DEFINED);
915
    }
916
917
    /**
918
     * @covers eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::link
@@ 948-973 (lines=26) @@
945
    /**
946
     * @covers eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::unlink
947
     */
948
    public function testUnlink()
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('unlink')
966
            ->with(22, 44, SPIType::STATUS_DEFINED)
967
            ->will(
968
                $this->returnValue(true)
969
            );
970
971
        $handler = $this->persistenceCacheHandler->contentTypeHandler();
972
        $handler->unlink(22, 44, SPIType::STATUS_DEFINED);
973
    }
974
975
    /**
976
     * @covers eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::unlink