Code Duplication    Length = 31-33 lines in 3 locations

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

@@ 904-934 (lines=31) @@
901
    /**
902
     * @covers \eZ\Publish\Core\Persistence\Cache\LocationHandler::changeMainLocation
903
     */
904
    public function testChangeMainLocation()
905
    {
906
        $this->loggerMock->expects($this->once())->method('logCall');
907
908
        $this->cacheMock
909
            ->expects($this->at(0))
910
            ->method('clear')
911
            ->with('content', 30)
912
            ->will($this->returnValue(true));
913
914
        $this->cacheMock
915
            ->expects($this->at(1))
916
            ->method('clear')
917
            ->with('content', 'info', 30)
918
            ->will($this->returnValue(true));
919
920
        $innerHandlerMock = $this->getSPILocationHandlerMock();
921
        $this->persistenceHandlerMock
922
            ->expects($this->once())
923
            ->method('locationHandler')
924
            ->will($this->returnValue($innerHandlerMock));
925
926
        $innerHandlerMock
927
            ->expects($this->once())
928
            ->method('changeMainLocation')
929
            ->with(30, 33)
930
            ->will($this->returnValue(true));
931
932
        $handler = $this->persistenceCacheHandler->locationHandler();
933
        $handler->changeMainLocation(30, 33);
934
    }
935
}
936

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

@@ 28-58 (lines=31) @@
25
    /**
26
     * @covers \eZ\Publish\Core\Persistence\Cache\SectionHandler::assign
27
     */
28
    public function testAssign()
29
    {
30
        $this->loggerMock->expects($this->once())->method('logCall');
31
32
        $this->cacheMock
33
            ->expects($this->at(0))
34
            ->method('clear')
35
            ->with('content', 44)
36
            ->will($this->returnValue(null));
37
38
        $this->cacheMock
39
            ->expects($this->at(1))
40
            ->method('clear')
41
            ->with('content', 'info', 44)
42
            ->will($this->returnValue(null));
43
44
        $innerHandler = $this->getSPISectionHandlerMock();
45
        $this->persistenceHandlerMock
46
            ->expects($this->once())
47
            ->method('sectionHandler')
48
            ->will($this->returnValue($innerHandler));
49
50
        $innerHandler
51
            ->expects($this->once())
52
            ->method('assign')
53
            ->with(33, 44)
54
            ->will($this->returnValue(null));
55
56
        $handler = $this->persistenceCacheHandler->sectionHandler();
57
        $handler->assign(33, 44);
58
    }
59
60
    /**
61
     * @covers \eZ\Publish\Core\Persistence\Cache\SectionHandler::assignmentsCount

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

@@ 656-688 (lines=33) @@
653
    /**
654
     * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::deleteRole
655
     */
656
    public function testDeleteRole()
657
    {
658
        $this->loggerMock->expects($this->once())->method('logCall');
659
660
        $innerHandlerMock = $this->getSPIUserHandlerMock();
661
        $this->persistenceHandlerMock
662
            ->expects($this->once())
663
            ->method('userHandler')
664
            ->will($this->returnValue($innerHandlerMock));
665
666
        $innerHandlerMock
667
            ->expects($this->once())
668
            ->method('deleteRole')
669
            ->with(33)
670
            ->will(
671
                $this->returnValue(true)
672
            );
673
674
        $this->cacheMock
675
            ->expects($this->at(0))
676
            ->method('clear')
677
            ->with('user', 'role', 33)
678
            ->will($this->returnValue(true));
679
680
        $this->cacheMock
681
            ->expects($this->at(1))
682
            ->method('clear')
683
            ->with('user', 'role', 'assignments')
684
            ->will($this->returnValue(true));
685
686
        $handler = $this->persistenceCacheHandler->userHandler();
687
        $handler->deleteRole(33);
688
    }
689
690
    /**
691
     * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::deleteRole