Code Duplication    Length = 17-23 lines in 4 locations

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

@@ 349-371 (lines=23) @@
346
    /**
347
     * Bug #81, bug #82.
348
     */
349
    public function testFindWithZeroLimit()
350
    {
351
        $locator = $this->getContentSearchHandler();
352
353
        $result = $locator->findContent(
354
            new Query(
355
                [
356
                    'filter' => new Criterion\ContentId(10),
357
                    'offset' => 0,
358
                    'limit' => 0,
359
                ]
360
            )
361
        );
362
363
        $this->assertEquals(
364
            1,
365
            $result->totalCount
366
        );
367
        $this->assertEquals(
368
            [],
369
            $result->searchHits
370
        );
371
    }
372
373
    /**
374
     * Issue with PHP_MAX_INT limit overflow in databases.

eZ/Publish/Core/Search/Legacy/Tests/Content/HandlerLocationTest.php 3 locations

@@ 297-313 (lines=17) @@
294
        $this->assertCount(1, $searchResult->searchHits);
295
    }
296
297
    public function testFindWithZeroLimit()
298
    {
299
        $handler = $this->getContentSearchHandler();
300
301
        $searchResult = $handler->findLocations(
302
            new LocationQuery(
303
                [
304
                    'filter' => new Criterion\LocationId(2),
305
                    'offset' => 0,
306
                    'limit' => 0,
307
                ]
308
            )
309
        );
310
311
        $this->assertEquals(1, $searchResult->totalCount);
312
        $this->assertEquals([], $searchResult->searchHits);
313
    }
314
315
    /**
316
     * Issue with PHP_MAX_INT limit overflow in databases.
@@ 318-334 (lines=17) @@
315
    /**
316
     * Issue with PHP_MAX_INT limit overflow in databases.
317
     */
318
    public function testFindWithNullLimit()
319
    {
320
        $handler = $this->getContentSearchHandler();
321
322
        $searchResult = $handler->findLocations(
323
            new LocationQuery(
324
                [
325
                    'filter' => new Criterion\LocationId(2),
326
                    'offset' => 0,
327
                    'limit' => null,
328
                ]
329
            )
330
        );
331
332
        $this->assertEquals(1, $searchResult->totalCount);
333
        $this->assertCount(1, $searchResult->searchHits);
334
    }
335
336
    /**
337
     * Issue with offsetting to the nonexistent results produces \ezcQueryInvalidParameterException exception.
@@ 339-355 (lines=17) @@
336
    /**
337
     * Issue with offsetting to the nonexistent results produces \ezcQueryInvalidParameterException exception.
338
     */
339
    public function testFindWithOffsetToNonexistent()
340
    {
341
        $handler = $this->getContentSearchHandler();
342
343
        $searchResult = $handler->findLocations(
344
            new LocationQuery(
345
                [
346
                    'filter' => new Criterion\LocationId(2),
347
                    'offset' => 1000,
348
                    'limit' => null,
349
                ]
350
            )
351
        );
352
353
        $this->assertEquals(1, $searchResult->totalCount);
354
        $this->assertEquals([], $searchResult->searchHits);
355
    }
356
357
    public function testLocationIdFilter()
358
    {