Code Duplication    Length = 24-24 lines in 2 locations

eZ/Publish/API/Repository/Tests/SearchServiceLocationTest.php 1 location

@@ 96-119 (lines=24) @@
93
     *
94
     * @see \eZ\Publish\API\Repository\SearchService::findLocations()
95
     */
96
    public function testFieldCollectionContains()
97
    {
98
        $testContent = $this->createMultipleCountriesContent();
99
100
        $query = new LocationQuery(
101
            array(
102
                'query' => new Criterion\Field(
103
                    'countries',
104
                    Criterion\Operator::CONTAINS,
105
                    'Belgium'
106
                ),
107
            )
108
        );
109
110
        $repository = $this->getRepository();
111
        $searchService = $repository->getSearchService();
112
        $result = $searchService->findLocations($query);
113
114
        $this->assertEquals(1, $result->totalCount);
115
        $this->assertEquals(
116
            $testContent->contentInfo->mainLocationId,
117
            $result->searchHits[0]->valueObject->id
118
        );
119
    }
120
121
    /**
122
     * Test for the findLocations() method.

eZ/Publish/API/Repository/Tests/SearchServiceTest.php 1 location

@@ 1057-1080 (lines=24) @@
1054
     *
1055
     * @see \eZ\Publish\API\Repository\SearchService::findContent()
1056
     */
1057
    public function testFieldCollectionContains()
1058
    {
1059
        $testContent = $this->createMultipleCountriesContent();
1060
1061
        $query = new Query(
1062
            array(
1063
                'query' => new Criterion\Field(
1064
                    'countries',
1065
                    Criterion\Operator::CONTAINS,
1066
                    'Belgium'
1067
                ),
1068
            )
1069
        );
1070
1071
        $repository = $this->getRepository();
1072
        $searchService = $repository->getSearchService();
1073
        $result = $searchService->findContent($query);
1074
1075
        $this->assertEquals(1, $result->totalCount);
1076
        $this->assertEquals(
1077
            $testContent->id,
1078
            $result->searchHits[0]->valueObject->id
1079
        );
1080
    }
1081
1082
    /**
1083
     * Test for the findContent() method.