Code Duplication    Length = 31-35 lines in 4 locations

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

@@ 193-227 (lines=35) @@
190
    /**
191
     * @covers \eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::loadGroup
192
     */
193
    public function testLoadGroupHasCache()
194
    {
195
        $this->loggerMock->expects($this->never())->method($this->anything());
196
        $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface');
197
        $this->cacheMock
198
            ->expects($this->once())
199
            ->method('getItem')
200
            ->with('contentTypeGroup', 55)
201
            ->will($this->returnValue($cacheItemMock));
202
203
        $cacheItemMock
204
            ->expects($this->once())
205
            ->method('get')
206
            ->will(
207
                $this->returnValue(
208
                    new SPITypeGroup()
209
                )
210
            );
211
212
        $cacheItemMock
213
            ->expects($this->once())
214
            ->method('isMiss')
215
            ->will($this->returnValue(false));
216
217
        $this->persistenceHandlerMock
218
            ->expects($this->never())
219
            ->method('contentTypeHandler');
220
221
        $cacheItemMock
222
            ->expects($this->never())
223
            ->method('set');
224
225
        $handler = $this->persistenceCacheHandler->contentTypeHandler();
226
        $handler->loadGroup(55);
227
    }
228
229
    /**
230
     * @covers \eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::loadGroupByIdentifier

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

@@ 73-103 (lines=31) @@
70
    /**
71
     * @covers \eZ\Publish\Core\Persistence\Cache\LocationHandler::load
72
     */
73
    public function testLoadHasCache()
74
    {
75
        $this->loggerMock->expects($this->never())->method($this->anything());
76
        $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface');
77
        $this->cacheMock
78
            ->expects($this->once())
79
            ->method('getItem')
80
            ->with('location', 33)
81
            ->will($this->returnValue($cacheItemMock));
82
83
        $cacheItemMock
84
            ->expects($this->once())
85
            ->method('get')
86
            ->will($this->returnValue(new Location(array('id' => 33))));
87
88
        $cacheItemMock
89
            ->expects($this->once())
90
            ->method('isMiss')
91
            ->will($this->returnValue(false));
92
93
        $this->persistenceHandlerMock
94
            ->expects($this->never())
95
            ->method('locationHandler');
96
97
        $cacheItemMock
98
            ->expects($this->never())
99
            ->method('set');
100
101
        $handler = $this->persistenceCacheHandler->locationHandler();
102
        $handler->load(33);
103
    }
104
105
    /**
106
     * @covers \eZ\Publish\Core\Persistence\Cache\LocationHandler::loadLocationsByContent

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

@@ 250-281 (lines=32) @@
247
    /**
248
     * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::loadRole
249
     */
250
    public function testLoadRoleHasCache()
251
    {
252
        $this->loggerMock->expects($this->never())->method('logCall');
253
254
        $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface');
255
        $this->cacheMock
256
            ->expects($this->once())
257
            ->method('getItem')
258
            ->with('user', 'role', 33)
259
            ->will($this->returnValue($cacheItemMock));
260
261
        $cacheItemMock
262
            ->expects($this->once())
263
            ->method('get')
264
            ->will($this->returnValue(new Role()));
265
266
        $cacheItemMock
267
            ->expects($this->once())
268
            ->method('isMiss')
269
            ->will($this->returnValue(false));
270
271
        $this->persistenceHandlerMock
272
            ->expects($this->never())
273
            ->method($this->anything());
274
275
        $cacheItemMock
276
            ->expects($this->never())
277
            ->method('set');
278
279
        $handler = $this->persistenceCacheHandler->userHandler();
280
        $handler->loadRole(33);
281
    }
282
283
    /**
284
     * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::loadRoleAssignmentsByGroupId

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

@@ 949-980 (lines=32) @@
946
    /**
947
     * @covers \eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::loadUrlAlias
948
     */
949
    public function testLoadUrlAliasHasCache()
950
    {
951
        $this->loggerMock->expects($this->never())->method('logCall');
952
953
        $this->persistenceHandlerMock
954
            ->expects($this->never())
955
            ->method($this->anything());
956
957
        $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface');
958
        $this->cacheMock
959
            ->expects($this->once())
960
            ->method('getItem')
961
            ->with('urlAlias', 55)
962
            ->will($this->returnValue($cacheItemMock));
963
964
        $cacheItemMock
965
            ->expects($this->once())
966
            ->method('get')
967
            ->will($this->returnValue(new UrlAlias(array('id' => 55))));
968
969
        $cacheItemMock
970
            ->expects($this->once())
971
            ->method('isMiss')
972
            ->will($this->returnValue(false));
973
974
        $cacheItemMock
975
            ->expects($this->never())
976
            ->method('set');
977
978
        $handler = $this->persistenceCacheHandler->urlAliasHandler();
979
        $handler->loadUrlAlias(55);
980
    }
981
982
    /**
983
     * @covers \eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::locationMoved