Code Duplication    Length = 14-14 lines in 2 locations

eZ/Publish/API/Repository/Tests/SearchServiceTest.php 2 locations

@@ 4367-4380 (lines=14) @@
4364
4365
        // Legacy search engine does have scoring, sorting the results by ID in that case
4366
        $setupFactory = $this->getSetupFactory();
4367
        if (get_class($setupFactory) === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') {
4368
            usort(
4369
                $searchHits,
4370
                function ($a, $b) {
4371
                    return ($a->valueObject->id < $b->valueObject->id) ? -1 : 1;
4372
                }
4373
            );
4374
4375
            $this->assertEquals($content1->id, $searchHits[0]->valueObject->id);
4376
            $this->assertEquals($content2->id, $searchHits[1]->valueObject->id);
4377
            $this->assertEquals($content3->id, $searchHits[2]->valueObject->id);
4378
4379
            return;
4380
        }
4381
4382
        // Assert scores are descending
4383
        $this->assertGreaterThan($searchHits[1]->score, $searchHits[0]->score);
@@ 4428-4441 (lines=14) @@
4425
4426
        // Legacy search engine does have scoring, sorting the results by ID in that case
4427
        $setupFactory = $this->getSetupFactory();
4428
        if (get_class($setupFactory) === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') {
4429
            usort(
4430
                $searchHits,
4431
                function ($a, $b) {
4432
                    return ($a->valueObject->id < $b->valueObject->id) ? -1 : 1;
4433
                }
4434
            );
4435
4436
            $this->assertEquals($content1->id, $searchHits[0]->valueObject->contentId);
4437
            $this->assertEquals($content2->id, $searchHits[1]->valueObject->contentId);
4438
            $this->assertEquals($content3->id, $searchHits[2]->valueObject->contentId);
4439
4440
            return;
4441
        }
4442
4443
        // Assert scores are descending
4444
        $this->assertGreaterThan($searchHits[1]->score, $searchHits[0]->score);