Code Duplication    Length = 30-36 lines in 5 locations

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

@@ 1162-1197 (lines=36) @@
1159
    /**
1160
     * @covers eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::removeFieldDefinition
1161
     */
1162
    public function testRemoveFieldDefinition()
1163
    {
1164
        $this->loggerMock->expects($this->once())->method('logCall');
1165
        $this->cacheMock
1166
            ->expects($this->at(0))
1167
            ->method('clear')
1168
            ->with('contentType', 44)
1169
            ->will($this->returnValue(true));
1170
1171
        $this->cacheMock
1172
            ->expects($this->at(1))
1173
            ->method('clear')
1174
            ->with('searchableFieldMap')
1175
            ->will($this->returnValue(true));
1176
1177
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Type\\Handler');
1178
        $this->persistenceHandlerMock
1179
            ->expects($this->once())
1180
            ->method('contentTypeHandler')
1181
            ->will($this->returnValue($innerHandlerMock));
1182
1183
        $innerHandlerMock
1184
            ->expects($this->once())
1185
            ->method('removeFieldDefinition')
1186
            ->with(
1187
                44,
1188
                SPIType::STATUS_DEFINED,
1189
                33
1190
            )
1191
            ->will(
1192
                $this->returnValue(true)
1193
            );
1194
1195
        $handler = $this->persistenceCacheHandler->contentTypeHandler();
1196
        $handler->removeFieldDefinition(44, SPIType::STATUS_DEFINED, 33);
1197
    }
1198
1199
    /**
1200
     * @covers eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::removeFieldDefinition

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

@@ 484-513 (lines=30) @@
481
    /**
482
     * @covers eZ\Publish\Core\Persistence\Cache\LocationHandler::move
483
     */
484
    public function testMove()
485
    {
486
        $this->loggerMock->expects($this->once())->method('logCall');
487
        $this->cacheMock
488
            ->expects($this->at(0))
489
            ->method('clear')
490
            ->with('location')
491
            ->will($this->returnValue(true));
492
493
        $this->cacheMock
494
            ->expects($this->at(1))
495
            ->method('clear')
496
            ->with('user', 'role', 'assignments', 'byGroup')
497
            ->will($this->returnValue(true));
498
499
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Location\\Handler');
500
        $this->persistenceHandlerMock
501
            ->expects($this->once())
502
            ->method('locationHandler')
503
            ->will($this->returnValue($innerHandlerMock));
504
505
        $innerHandlerMock
506
            ->expects($this->once())
507
            ->method('move')
508
            ->with(33, 66)
509
            ->will($this->returnValue(true));
510
511
        $handler = $this->persistenceCacheHandler->locationHandler();
512
        $handler->move(33, 66);
513
    }
514
515
    /**
516
     * @covers eZ\Publish\Core\Persistence\Cache\LocationHandler::markSubtreeModified
@@ 883-913 (lines=31) @@
880
    /**
881
     * @covers eZ\Publish\Core\Persistence\Cache\LocationHandler::changeMainLocation
882
     */
883
    public function testChangeMainLocation()
884
    {
885
        $this->loggerMock->expects($this->once())->method('logCall');
886
887
        $this->cacheMock
888
            ->expects($this->at(0))
889
            ->method('clear')
890
            ->with('content', 30)
891
            ->will($this->returnValue(true));
892
893
        $this->cacheMock
894
            ->expects($this->at(1))
895
            ->method('clear')
896
            ->with('content', 'info', 30)
897
            ->will($this->returnValue(true));
898
899
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Location\\Handler');
900
        $this->persistenceHandlerMock
901
            ->expects($this->once())
902
            ->method('locationHandler')
903
            ->will($this->returnValue($innerHandlerMock));
904
905
        $innerHandlerMock
906
            ->expects($this->once())
907
            ->method('changeMainLocation')
908
            ->with(30, 33)
909
            ->will($this->returnValue(true));
910
911
        $handler = $this->persistenceCacheHandler->locationHandler();
912
        $handler->changeMainLocation(30, 33);
913
    }
914
}
915

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

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

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

@@ 643-675 (lines=33) @@
640
    /**
641
     * @covers eZ\Publish\Core\Persistence\Cache\UserHandler::deleteRole
642
     */
643
    public function testDeleteRole()
644
    {
645
        $this->loggerMock->expects($this->once())->method('logCall');
646
647
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\User\\Handler');
648
        $this->persistenceHandlerMock
649
            ->expects($this->once())
650
            ->method('userHandler')
651
            ->will($this->returnValue($innerHandlerMock));
652
653
        $innerHandlerMock
654
            ->expects($this->once())
655
            ->method('deleteRole')
656
            ->with(33)
657
            ->will(
658
                $this->returnValue(true)
659
            );
660
661
        $this->cacheMock
662
            ->expects($this->at(0))
663
            ->method('clear')
664
            ->with('user', 'role', 33)
665
            ->will($this->returnValue(true));
666
667
        $this->cacheMock
668
            ->expects($this->at(1))
669
            ->method('clear')
670
            ->with('user', 'role', 'assignments')
671
            ->will($this->returnValue(true));
672
673
        $handler = $this->persistenceCacheHandler->userHandler();
674
        $handler->deleteRole(33);
675
    }
676
677
    /**
678
     * @covers eZ\Publish\Core\Persistence\Cache\UserHandler::deleteRole