Code Duplication    Length = 14-14 lines in 2 locations

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

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