Code Duplication    Length = 31-35 lines in 4 locations

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

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

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

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

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

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

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

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