Code Duplication    Length = 17-23 lines in 4 locations

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

@@ 218-234 (lines=17) @@
215
        $this->assertCount(1, $searchResult->searchHits);
216
    }
217
218
    public function testFindWithZeroLimit()
219
    {
220
        $handler = $this->getContentSearchHandler();
221
222
        $searchResult = $handler->findLocations(
223
            new LocationQuery(
224
                [
225
                    'filter' => new Criterion\LocationId(2),
226
                    'offset' => 0,
227
                    'limit' => 0,
228
                ]
229
            )
230
        );
231
232
        $this->assertEquals(1, $searchResult->totalCount);
233
        $this->assertEquals([], $searchResult->searchHits);
234
    }
235
236
    /**
237
     * Issue with PHP_MAX_INT limit overflow in databases.
@@ 239-255 (lines=17) @@
236
    /**
237
     * Issue with PHP_MAX_INT limit overflow in databases.
238
     */
239
    public function testFindWithNullLimit()
240
    {
241
        $handler = $this->getContentSearchHandler();
242
243
        $searchResult = $handler->findLocations(
244
            new LocationQuery(
245
                [
246
                    'filter' => new Criterion\LocationId(2),
247
                    'offset' => 0,
248
                    'limit' => null,
249
                ]
250
            )
251
        );
252
253
        $this->assertEquals(1, $searchResult->totalCount);
254
        $this->assertCount(1, $searchResult->searchHits);
255
    }
256
257
    /**
258
     * Issue with offsetting to the nonexistent results produces \ezcQueryInvalidParameterException exception.
@@ 260-276 (lines=17) @@
257
    /**
258
     * Issue with offsetting to the nonexistent results produces \ezcQueryInvalidParameterException exception.
259
     */
260
    public function testFindWithOffsetToNonexistent()
261
    {
262
        $handler = $this->getContentSearchHandler();
263
264
        $searchResult = $handler->findLocations(
265
            new LocationQuery(
266
                [
267
                    'filter' => new Criterion\LocationId(2),
268
                    'offset' => 1000,
269
                    'limit' => null,
270
                ]
271
            )
272
        );
273
274
        $this->assertEquals(1, $searchResult->totalCount);
275
        $this->assertEquals([], $searchResult->searchHits);
276
    }
277
278
    public function testLocationIdFilter()
279
    {

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

@@ 267-289 (lines=23) @@
264
    /**
265
     * Bug #81, bug #82.
266
     */
267
    public function testFindWithZeroLimit()
268
    {
269
        $locator = $this->getContentSearchHandler();
270
271
        $result = $locator->findContent(
272
            new Query(
273
                [
274
                    'filter' => new Criterion\ContentId(10),
275
                    'offset' => 0,
276
                    'limit' => 0,
277
                ]
278
            )
279
        );
280
281
        $this->assertEquals(
282
            1,
283
            $result->totalCount
284
        );
285
        $this->assertEquals(
286
            [],
287
            $result->searchHits
288
        );
289
    }
290
291
    /**
292
     * Issue with PHP_MAX_INT limit overflow in databases.