Code Duplication    Length = 23-23 lines in 2 locations

eZ/Publish/API/Repository/Tests/FieldType/SearchBaseIntegrationTest.php 2 locations

@@ 1335-1357 (lines=23) @@
1332
     *
1333
     * @return \eZ\Publish\API\Repository\Values\Content\Search\SearchResult
1334
     */
1335
    protected function findContent(Repository $repository, Criterion $criterion, $filter)
1336
    {
1337
        $searchService = $repository->getSearchService();
1338
1339
        if ($filter) {
1340
            $criteriaProperty = 'filter';
1341
        } else {
1342
            $criteriaProperty = 'query';
1343
        }
1344
1345
        $query = new Query(
1346
            [
1347
                $criteriaProperty => new Criterion\LogicalAnd(
1348
                    [
1349
                        new Criterion\ContentTypeIdentifier('test-' . $this->getTypeName()),
1350
                        $criterion,
1351
                    ]
1352
                ),
1353
            ]
1354
        );
1355
1356
        return $searchService->findContent($query);
1357
    }
1358
1359
    /**
1360
     * Returns SearchResult of the tested Content for the given $sortClause.
@@ 1392-1414 (lines=23) @@
1389
     *
1390
     * @return \eZ\Publish\API\Repository\Values\Content\Search\SearchResult
1391
     */
1392
    protected function findLocations(Repository $repository, Criterion $criterion, $filter)
1393
    {
1394
        $searchService = $repository->getSearchService();
1395
1396
        if ($filter) {
1397
            $criteriaProperty = 'filter';
1398
        } else {
1399
            $criteriaProperty = 'query';
1400
        }
1401
1402
        $query = new LocationQuery(
1403
            [
1404
                $criteriaProperty => new Criterion\LogicalAnd(
1405
                    [
1406
                        new Criterion\ContentTypeIdentifier('test-' . $this->getTypeName()),
1407
                        $criterion,
1408
                    ]
1409
                ),
1410
            ]
1411
        );
1412
1413
        return $searchService->findLocations($query);
1414
    }
1415
1416
    /**
1417
     * Returns SearchResult of the tested Locations for the given $sortClause.