Code Duplication    Length = 30-36 lines in 5 locations

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

@@ 1104-1139 (lines=36) @@
1101
    /**
1102
     * @covers eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::removeFieldDefinition
1103
     */
1104
    public function testRemoveFieldDefinition()
1105
    {
1106
        $this->loggerMock->expects($this->once())->method('logCall');
1107
        $this->cacheMock
1108
            ->expects($this->at(0))
1109
            ->method('clear')
1110
            ->with('contentType', 44)
1111
            ->will($this->returnValue(true));
1112
1113
        $this->cacheMock
1114
            ->expects($this->at(1))
1115
            ->method('clear')
1116
            ->with('searchableFieldMap')
1117
            ->will($this->returnValue(true));
1118
1119
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Type\\Handler');
1120
        $this->persistenceHandlerMock
1121
            ->expects($this->once())
1122
            ->method('contentTypeHandler')
1123
            ->will($this->returnValue($innerHandlerMock));
1124
1125
        $innerHandlerMock
1126
            ->expects($this->once())
1127
            ->method('removeFieldDefinition')
1128
            ->with(
1129
                44,
1130
                SPIType::STATUS_DEFINED,
1131
                33
1132
            )
1133
            ->will(
1134
                $this->returnValue(true)
1135
            );
1136
1137
        $handler = $this->persistenceCacheHandler->contentTypeHandler();
1138
        $handler->removeFieldDefinition(44, SPIType::STATUS_DEFINED, 33);
1139
    }
1140
1141
    /**
1142
     * @covers eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::removeFieldDefinition

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

@@ 462-491 (lines=30) @@
459
    /**
460
     * @covers eZ\Publish\Core\Persistence\Cache\LocationHandler::move
461
     */
462
    public function testMove()
463
    {
464
        $this->loggerMock->expects($this->once())->method('logCall');
465
        $this->cacheMock
466
            ->expects($this->at(0))
467
            ->method('clear')
468
            ->with('location')
469
            ->will($this->returnValue(true));
470
471
        $this->cacheMock
472
            ->expects($this->at(1))
473
            ->method('clear')
474
            ->with('user', 'role', 'assignments', 'byGroup')
475
            ->will($this->returnValue(true));
476
477
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Location\\Handler');
478
        $this->persistenceHandlerMock
479
            ->expects($this->once())
480
            ->method('locationHandler')
481
            ->will($this->returnValue($innerHandlerMock));
482
483
        $innerHandlerMock
484
            ->expects($this->once())
485
            ->method('move')
486
            ->with(33, 66)
487
            ->will($this->returnValue(true));
488
489
        $handler = $this->persistenceCacheHandler->locationHandler();
490
        $handler->move(33, 66);
491
    }
492
493
    /**
494
     * @covers eZ\Publish\Core\Persistence\Cache\LocationHandler::markSubtreeModified
@@ 807-837 (lines=31) @@
804
    /**
805
     * @covers eZ\Publish\Core\Persistence\Cache\LocationHandler::changeMainLocation
806
     */
807
    public function testChangeMainLocation()
808
    {
809
        $this->loggerMock->expects($this->once())->method('logCall');
810
811
        $this->cacheMock
812
            ->expects($this->at(0))
813
            ->method('clear')
814
            ->with('content', 30)
815
            ->will($this->returnValue(true));
816
817
        $this->cacheMock
818
            ->expects($this->at(1))
819
            ->method('clear')
820
            ->with('content', 'info', 30)
821
            ->will($this->returnValue(true));
822
823
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Location\\Handler');
824
        $this->persistenceHandlerMock
825
            ->expects($this->once())
826
            ->method('locationHandler')
827
            ->will($this->returnValue($innerHandlerMock));
828
829
        $innerHandlerMock
830
            ->expects($this->once())
831
            ->method('changeMainLocation')
832
            ->with(30, 33)
833
            ->will($this->returnValue(true));
834
835
        $handler = $this->persistenceCacheHandler->locationHandler();
836
        $handler->changeMainLocation(30, 33);
837
    }
838
}
839

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/UserHandlerTest.php 1 location

@@ 627-659 (lines=33) @@
624
    /**
625
     * @covers eZ\Publish\Core\Persistence\Cache\UserHandler::deleteRole
626
     */
627
    public function testDeleteRole()
628
    {
629
        $this->loggerMock->expects($this->once())->method('logCall');
630
631
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\User\\Handler');
632
        $this->persistenceHandlerMock
633
            ->expects($this->once())
634
            ->method('userHandler')
635
            ->will($this->returnValue($innerHandlerMock));
636
637
        $innerHandlerMock
638
            ->expects($this->once())
639
            ->method('deleteRole')
640
            ->with(33)
641
            ->will(
642
                $this->returnValue(true)
643
            );
644
645
        $this->cacheMock
646
            ->expects($this->at(0))
647
            ->method('clear')
648
            ->with('user', 'role', 33)
649
            ->will($this->returnValue(true));
650
651
        $this->cacheMock
652
            ->expects($this->at(1))
653
            ->method('clear')
654
            ->with('user', 'role', 'assignments')
655
            ->will($this->returnValue(true));
656
657
        $handler = $this->persistenceCacheHandler->userHandler();
658
        $handler->deleteRole(33);
659
    }
660
661
    /**
662
     * @covers eZ\Publish\Core\Persistence\Cache\UserHandler::deleteRole