Code Duplication    Length = 26-27 lines in 2 locations

eZ/Publish/API/Repository/Tests/SearchServiceTest.php 1 location

@@ 1293-1319 (lines=27) @@
1290
     *
1291
     * @see \eZ\Publish\API\Repository\SearchService::findContent()
1292
     */
1293
    public function testFieldIsEmpty()
1294
    {
1295
        $testContents = $this->createMovieContent();
1296
1297
        $query = new Query(
1298
            [
1299
                'query' => new Criterion\IsFieldEmpty('subtitle'),
1300
            ]
1301
        );
1302
1303
        $repository = $this->getRepository();
1304
        $searchService = $repository->getSearchService();
1305
        $result = $searchService->findContent($query, ['eng-GB']);
1306
1307
        $this->assertEquals(2, $result->totalCount);
1308
1309
        $this->assertEquals(
1310
            $testContents[0]->id,
1311
            $result->searchHits[0]->valueObject->id
1312
        );
1313
        $this->assertEquals(
1314
            $testContents[1]->id,
1315
            $result->searchHits[1]->valueObject->id
1316
        );
1317
1318
        return $testContents;
1319
    }
1320
1321
    /**
1322
     * Test for the findContent() method.

eZ/Publish/API/Repository/Tests/SearchServiceLocationTest.php 1 location

@@ 212-237 (lines=26) @@
209
     *
210
     * @see \eZ\Publish\API\Repository\SearchService::findLocations()
211
     */
212
    public function testFieldIsEmptyInLocation()
213
    {
214
        $testContents = $this->createMovieContent();
215
216
        $query = new LocationQuery(
217
            [
218
                'query' => new Criterion\IsFieldEmpty('subtitle'),
219
            ]
220
        );
221
222
        $repository = $this->getRepository();
223
        $searchService = $repository->getSearchService();
224
        $result = $searchService->findLocations($query);
225
226
        $this->assertEquals(2, $result->totalCount);
227
228
        $this->assertEquals(
229
            $testContents[0]->contentInfo->mainLocationId,
230
            $result->searchHits[0]->valueObject->id
231
        );
232
233
        $this->assertEquals(
234
            $testContents[1]->contentInfo->mainLocationId,
235
            $result->searchHits[1]->valueObject->id
236
        );
237
    }
238
239
    /**
240
     * Test for the findLocations() method.