Code Duplication    Length = 14-14 lines in 2 locations

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

@@ 4230-4243 (lines=14) @@
4227
4228
        // Legacy search engine does have scoring, sorting the results by ID in that case
4229
        $setupFactory = $this->getSetupFactory();
4230
        if (get_class($setupFactory) === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') {
4231
            usort(
4232
                $searchHits,
4233
                function ($a, $b) {
4234
                    return ($a->valueObject->id < $b->valueObject->id) ? -1 : 1;
4235
                }
4236
            );
4237
4238
            $this->assertEquals($content1->id, $searchHits[0]->valueObject->id);
4239
            $this->assertEquals($content2->id, $searchHits[1]->valueObject->id);
4240
            $this->assertEquals($content3->id, $searchHits[2]->valueObject->id);
4241
4242
            return;
4243
        }
4244
4245
        // Assert scores are descending
4246
        $this->assertGreaterThan($searchHits[1]->score, $searchHits[0]->score);
@@ 4291-4304 (lines=14) @@
4288
4289
        // Legacy search engine does have scoring, sorting the results by ID in that case
4290
        $setupFactory = $this->getSetupFactory();
4291
        if (get_class($setupFactory) === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') {
4292
            usort(
4293
                $searchHits,
4294
                function ($a, $b) {
4295
                    return ($a->valueObject->id < $b->valueObject->id) ? -1 : 1;
4296
                }
4297
            );
4298
4299
            $this->assertEquals($content1->id, $searchHits[0]->valueObject->contentId);
4300
            $this->assertEquals($content2->id, $searchHits[1]->valueObject->contentId);
4301
            $this->assertEquals($content3->id, $searchHits[2]->valueObject->contentId);
4302
4303
            return;
4304
        }
4305
4306
        // Assert scores are descending
4307
        $this->assertGreaterThan($searchHits[1]->score, $searchHits[0]->score);