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

@@ 1016-1047 (lines=32) @@
1013
    /**
1014
     * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::loadUrlAlias
1015
     */
1016
    public function testLoadUrlAliasHasCache()
1017
    {
1018
        $this->loggerMock->expects($this->never())->method('logCall');
1019
1020
        $this->persistenceHandlerMock
1021
            ->expects($this->never())
1022
            ->method($this->anything());
1023
1024
        $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface');
1025
        $this->cacheMock
1026
            ->expects($this->once())
1027
            ->method('getItem')
1028
            ->with('urlAlias', 55)
1029
            ->will($this->returnValue($cacheItemMock));
1030
1031
        $cacheItemMock
1032
            ->expects($this->once())
1033
            ->method('get')
1034
            ->will($this->returnValue(new UrlAlias(array('id' => 55))));
1035
1036
        $cacheItemMock
1037
            ->expects($this->once())
1038
            ->method('isMiss')
1039
            ->will($this->returnValue(false));
1040
1041
        $cacheItemMock
1042
            ->expects($this->never())
1043
            ->method('set');
1044
1045
        $handler = $this->persistenceCacheHandler->urlAliasHandler();
1046
        $handler->loadUrlAlias(55);
1047
    }
1048
1049
    /**
1050
     * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::locationMoved