Code Duplication    Length = 30-36 lines in 5 locations

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

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

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

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

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

@@ 486-515 (lines=30) @@
483
    /**
484
     * @covers eZ\Publish\Core\Persistence\Cache\LocationHandler::move
485
     */
486
    public function testMove()
487
    {
488
        $this->loggerMock->expects($this->once())->method('logCall');
489
        $this->cacheMock
490
            ->expects($this->at(0))
491
            ->method('clear')
492
            ->with('location')
493
            ->will($this->returnValue(true));
494
495
        $this->cacheMock
496
            ->expects($this->at(1))
497
            ->method('clear')
498
            ->with('user', 'role', 'assignments', 'byGroup')
499
            ->will($this->returnValue(true));
500
501
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Location\\Handler');
502
        $this->persistenceHandlerMock
503
            ->expects($this->once())
504
            ->method('locationHandler')
505
            ->will($this->returnValue($innerHandlerMock));
506
507
        $innerHandlerMock
508
            ->expects($this->once())
509
            ->method('move')
510
            ->with(33, 66)
511
            ->will($this->returnValue(true));
512
513
        $handler = $this->persistenceCacheHandler->locationHandler();
514
        $handler->move(33, 66);
515
    }
516
517
    /**
518
     * @covers eZ\Publish\Core\Persistence\Cache\LocationHandler::markSubtreeModified
@@ 837-867 (lines=31) @@
834
    /**
835
     * @covers eZ\Publish\Core\Persistence\Cache\LocationHandler::changeMainLocation
836
     */
837
    public function testChangeMainLocation()
838
    {
839
        $this->loggerMock->expects($this->once())->method('logCall');
840
841
        $this->cacheMock
842
            ->expects($this->at(0))
843
            ->method('clear')
844
            ->with('content', 30)
845
            ->will($this->returnValue(true));
846
847
        $this->cacheMock
848
            ->expects($this->at(1))
849
            ->method('clear')
850
            ->with('content', 'info', 30)
851
            ->will($this->returnValue(true));
852
853
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Location\\Handler');
854
        $this->persistenceHandlerMock
855
            ->expects($this->once())
856
            ->method('locationHandler')
857
            ->will($this->returnValue($innerHandlerMock));
858
859
        $innerHandlerMock
860
            ->expects($this->once())
861
            ->method('changeMainLocation')
862
            ->with(30, 33)
863
            ->will($this->returnValue(true));
864
865
        $handler = $this->persistenceCacheHandler->locationHandler();
866
        $handler->changeMainLocation(30, 33);
867
    }
868
}
869

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

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