Code Duplication    Length = 32-32 lines in 2 locations

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

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

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

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