Code Duplication    Length = 32-32 lines in 2 locations

eZ/Publish/Core/Search/Legacy/Tests/Content/HandlerContentSortTest.php 1 location

@@ 503-534 (lines=32) @@
500
        }
501
    }
502
503
    public function testSortFieldNumeric()
504
    {
505
        $locator = $this->getContentSearchHandler();
506
507
        $result = $locator->findContent(
508
            new Query(
509
                [
510
                    'filter' => new Criterion\LogicalAnd(
511
                        [
512
                            new Criterion\SectionId([1]),
513
                            new Criterion\ContentTypeIdentifier('product'),
514
                        ]
515
                    ),
516
                    'offset' => 0,
517
                    'limit' => null,
518
                    'sortClauses' => [
519
                        new SortClause\Field('product', 'price', Query::SORT_ASC, 'eng-US'),
520
                    ],
521
                ]
522
            )
523
        );
524
525
        $this->assertEquals(
526
            [73, 71, 72, 69],
527
            array_map(
528
                function ($hit) {
529
                    return $hit->valueObject->id;
530
                },
531
                $result->searchHits
532
            )
533
        );
534
    }
535
}
536

eZ/Publish/Core/Search/Legacy/Tests/Content/HandlerLocationSortTest.php 1 location

@@ 657-688 (lines=32) @@
654
        }
655
    }
656
657
    public function testSortFieldNumeric()
658
    {
659
        $handler = $this->getContentSearchHandler();
660
661
        $result = $handler->findLocations(
662
            new LocationQuery(
663
                [
664
                    'filter' => new Criterion\LogicalAnd(
665
                        [
666
                            new Criterion\SectionId([1]),
667
                            new Criterion\ContentTypeIdentifier('product'),
668
                        ]
669
                    ),
670
                    'offset' => 0,
671
                    'limit' => null,
672
                    'sortClauses' => [
673
                        new SortClause\Field('product', 'price', LocationQuery::SORT_ASC, 'eng-US'),
674
                    ],
675
                ]
676
            )
677
        );
678
679
        $this->assertEquals(
680
            [75, 73, 74, 71],
681
            array_map(
682
                function ($hit) {
683
                    return $hit->valueObject->id;
684
                },
685
                $result->searchHits
686
            )
687
        );
688
    }
689
690
    public function testSortIsMainLocationAscending()
691
    {