Code Duplication    Length = 31-35 lines in 4 locations

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

@@ 205-239 (lines=35) @@
202
    /**
203
     * @covers \eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::loadGroup
204
     */
205
    public function testLoadGroupHasCache()
206
    {
207
        $this->loggerMock->expects($this->never())->method($this->anything());
208
        $cacheItemMock = $this->getCacheItemMock();
209
        $this->cacheMock
210
            ->expects($this->once())
211
            ->method('getItem')
212
            ->with('contentTypeGroup', 55)
213
            ->will($this->returnValue($cacheItemMock));
214
215
        $cacheItemMock
216
            ->expects($this->once())
217
            ->method('get')
218
            ->will(
219
                $this->returnValue(
220
                    new SPITypeGroup()
221
                )
222
            );
223
224
        $cacheItemMock
225
            ->expects($this->once())
226
            ->method('isMiss')
227
            ->will($this->returnValue(false));
228
229
        $this->persistenceHandlerMock
230
            ->expects($this->never())
231
            ->method('contentTypeHandler');
232
233
        $cacheItemMock
234
            ->expects($this->never())
235
            ->method('set');
236
237
        $handler = $this->persistenceCacheHandler->contentTypeHandler();
238
        $handler->loadGroup(55);
239
    }
240
241
    /**
242
     * @covers \eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::loadGroupByIdentifier

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

@@ 87-117 (lines=31) @@
84
    /**
85
     * @covers \eZ\Publish\Core\Persistence\Cache\LocationHandler::load
86
     */
87
    public function testLoadHasCache()
88
    {
89
        $this->loggerMock->expects($this->never())->method($this->anything());
90
        $cacheItemMock = $this->getCacheItemMock();
91
        $this->cacheMock
92
            ->expects($this->once())
93
            ->method('getItem')
94
            ->with('location', 33)
95
            ->will($this->returnValue($cacheItemMock));
96
97
        $cacheItemMock
98
            ->expects($this->once())
99
            ->method('get')
100
            ->will($this->returnValue(new Location(array('id' => 33))));
101
102
        $cacheItemMock
103
            ->expects($this->once())
104
            ->method('isMiss')
105
            ->will($this->returnValue(false));
106
107
        $this->persistenceHandlerMock
108
            ->expects($this->never())
109
            ->method('locationHandler');
110
111
        $cacheItemMock
112
            ->expects($this->never())
113
            ->method('set');
114
115
        $handler = $this->persistenceCacheHandler->locationHandler();
116
        $handler->load(33);
117
    }
118
119
    /**
120
     * @covers \eZ\Publish\Core\Persistence\Cache\LocationHandler::loadLocationsByContent

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

@@ 986-1017 (lines=32) @@
983
    /**
984
     * @covers \eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::loadUrlAlias
985
     */
986
    public function testLoadUrlAliasHasCache()
987
    {
988
        $this->loggerMock->expects($this->never())->method('logCall');
989
990
        $this->persistenceHandlerMock
991
            ->expects($this->never())
992
            ->method($this->anything());
993
994
        $cacheItemMock = $this->getCacheItemMock();
995
        $this->cacheMock
996
            ->expects($this->once())
997
            ->method('getItem')
998
            ->with('urlAlias', 55)
999
            ->will($this->returnValue($cacheItemMock));
1000
1001
        $cacheItemMock
1002
            ->expects($this->once())
1003
            ->method('get')
1004
            ->will($this->returnValue(new UrlAlias(array('id' => 55))));
1005
1006
        $cacheItemMock
1007
            ->expects($this->once())
1008
            ->method('isMiss')
1009
            ->will($this->returnValue(false));
1010
1011
        $cacheItemMock
1012
            ->expects($this->never())
1013
            ->method('set');
1014
1015
        $handler = $this->persistenceCacheHandler->urlAliasHandler();
1016
        $handler->loadUrlAlias(55);
1017
    }
1018
1019
    /**
1020
     * @covers \eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::locationMoved

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

@@ 263-294 (lines=32) @@
260
    /**
261
     * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::loadRole
262
     */
263
    public function testLoadRoleHasCache()
264
    {
265
        $this->loggerMock->expects($this->never())->method('logCall');
266
267
        $cacheItemMock = $this->getCacheItemMock();
268
        $this->cacheMock
269
            ->expects($this->once())
270
            ->method('getItem')
271
            ->with('user', 'role', 33)
272
            ->will($this->returnValue($cacheItemMock));
273
274
        $cacheItemMock
275
            ->expects($this->once())
276
            ->method('get')
277
            ->will($this->returnValue(new Role()));
278
279
        $cacheItemMock
280
            ->expects($this->once())
281
            ->method('isMiss')
282
            ->will($this->returnValue(false));
283
284
        $this->persistenceHandlerMock
285
            ->expects($this->never())
286
            ->method($this->anything());
287
288
        $cacheItemMock
289
            ->expects($this->never())
290
            ->method('set');
291
292
        $handler = $this->persistenceCacheHandler->userHandler();
293
        $handler->loadRole(33);
294
    }
295
296
    /**
297
     * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::loadRoleAssignmentsByGroupId