Code Duplication    Length = 14-14 lines in 2 locations

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

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