Code Duplication    Length = 14-20 lines in 7 locations

eZ/Publish/Core/Search/Legacy/Tests/Content/HandlerContentTest.php 7 locations

@@ 562-575 (lines=14) @@
559
        );
560
    }
561
562
    public function testContentTypeIdFilter()
563
    {
564
        $this->assertSearchResults(
565
            [10, 14, 226],
566
            $this->getContentSearchHandler()->findContent(
567
                new Query(
568
                    [
569
                        'filter' => new Criterion\ContentTypeId(4),
570
                        'limit' => 10,
571
                    ]
572
                )
573
            )
574
        );
575
    }
576
577
    public function testContentTypeIdentifierFilter()
578
    {
@@ 827-844 (lines=18) @@
824
        );
825
    }
826
827
    public function testFieldFilterIn()
828
    {
829
        $this->assertSearchResults(
830
            [11, 42],
831
            $this->getContentSearchHandler()->findContent(
832
                new Query(
833
                    [
834
                        'filter' => new Criterion\Field(
835
                            'name',
836
                            Criterion\Operator::IN,
837
                            ['members', 'anonymous users']
838
                        ),
839
                        'limit' => 10,
840
                    ]
841
                )
842
            )
843
        );
844
    }
845
846
    public function testFieldFilterContainsPartial()
847
    {
@@ 903-920 (lines=18) @@
900
        );
901
    }
902
903
    public function testFieldFilterBetween()
904
    {
905
        $this->assertSearchResults(
906
            [69, 71, 72],
907
            $this->getContentSearchHandler()->findContent(
908
                new Query(
909
                    [
910
                        'filter' => new Criterion\Field(
911
                            'price',
912
                            Criterion\Operator::BETWEEN,
913
                            [10000, 1000000]
914
                        ),
915
                        'limit' => 10,
916
                    ]
917
                )
918
            )
919
        );
920
    }
921
922
    public function testFieldFilterOr()
923
    {
@@ 950-963 (lines=14) @@
947
        );
948
    }
949
950
    public function testFullTextFilter()
951
    {
952
        $this->assertSearchResults(
953
            [191],
954
            $this->getContentSearchHandler()->findContent(
955
                new Query(
956
                    [
957
                        'filter' => new Criterion\FullText('applied webpage'),
958
                        'limit' => 10,
959
                    ]
960
                )
961
            )
962
        );
963
    }
964
965
    public function testFullTextWildcardFilter()
966
    {
@@ 965-978 (lines=14) @@
962
        );
963
    }
964
965
    public function testFullTextWildcardFilter()
966
    {
967
        $this->assertSearchResults(
968
            [191],
969
            $this->getContentSearchHandler()->findContent(
970
                new Query(
971
                    [
972
                        'filter' => new Criterion\FullText('applie*'),
973
                        'limit' => 10,
974
                    ]
975
                )
976
            )
977
        );
978
    }
979
980
    public function testFullTextDisabledWildcardFilter()
981
    {
@@ 980-995 (lines=16) @@
977
        );
978
    }
979
980
    public function testFullTextDisabledWildcardFilter()
981
    {
982
        $this->assertSearchResults(
983
            [],
984
            $this->getContentSearchHandler(
985
                ['enableWildcards' => false]
986
            )->findContent(
987
                new Query(
988
                    [
989
                        'filter' => new Criterion\FullText('applie*'),
990
                        'limit' => 10,
991
                    ]
992
                )
993
            )
994
        );
995
    }
996
997
    public function testFullTextFilterStopwordRemoval()
998
    {
@@ 997-1016 (lines=20) @@
994
        );
995
    }
996
997
    public function testFullTextFilterStopwordRemoval()
998
    {
999
        $handler = $this->getContentSearchHandler(
1000
            [
1001
                'stopWordThresholdFactor' => 0.1,
1002
            ]
1003
        );
1004
1005
        $this->assertSearchResults(
1006
            [],
1007
            $handler->findContent(
1008
                new Query(
1009
                    [
1010
                        'filter' => new Criterion\FullText('the'),
1011
                        'limit' => 10,
1012
                    ]
1013
                )
1014
            )
1015
        );
1016
    }
1017
1018
    public function testFullTextFilterNoStopwordRemoval()
1019
    {