Code Duplication    Length = 29-29 lines in 2 locations

eZ/Publish/Core/Search/Legacy/Tests/Content/HandlerLocationSortTest.php 1 location

@@ 188-216 (lines=29) @@
185
     *
186
     * @return \eZ\Publish\Core\Persistence\Legacy\Content\Location\Mapper
187
     */
188
    protected function getLocationMapperMock()
189
    {
190
        $mapperMock = $this->getMock(
191
            'eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\Location\\Mapper',
192
            array('createLocationsFromRows')
193
        );
194
        $mapperMock
195
            ->expects($this->any())
196
            ->method('createLocationsFromRows')
197
            ->with($this->isType('array'))
198
            ->will(
199
                $this->returnCallback(
200
                    function ($rows) {
201
                        $locations = array();
202
                        foreach ($rows as $row) {
203
                            $locationId = (int)$row['node_id'];
204
                            if (!isset($locations[$locationId])) {
205
                                $locations[$locationId] = new SPILocation();
206
                                $locations[$locationId]->id = $locationId;
207
                            }
208
                        }
209
210
                        return array_values($locations);
211
                    }
212
                )
213
            );
214
215
        return $mapperMock;
216
    }
217
218
    public function testNoSorting()
219
    {

eZ/Publish/Core/Search/Legacy/Tests/Content/HandlerLocationTest.php 1 location

@@ 252-280 (lines=29) @@
249
     *
250
     * @return \eZ\Publish\Core\Persistence\Legacy\Content\Location\Mapper
251
     */
252
    protected function getLocationMapperMock()
253
    {
254
        $mapperMock = $this->getMock(
255
            'eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\Location\\Mapper',
256
            array('createLocationsFromRows')
257
        );
258
        $mapperMock
259
            ->expects($this->any())
260
            ->method('createLocationsFromRows')
261
            ->with($this->isType('array'))
262
            ->will(
263
                $this->returnCallback(
264
                    function ($rows) {
265
                        $locations = array();
266
                        foreach ($rows as $row) {
267
                            $locationId = (int)$row['node_id'];
268
                            if (!isset($locations[$locationId])) {
269
                                $locations[$locationId] = new SPILocation();
270
                                $locations[$locationId]->id = $locationId;
271
                            }
272
                        }
273
274
                        return array_values($locations);
275
                    }
276
                )
277
            );
278
279
        return $mapperMock;
280
    }
281
282
    public function testFindWithoutOffsetLimit()
283
    {