Code Duplication    Length = 24-24 lines in 2 locations

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

@@ 109-132 (lines=24) @@
106
     *
107
     * @see \eZ\Publish\API\Repository\SearchService::findLocations()
108
     */
109
    public function testFieldCollectionContains()
110
    {
111
        $testContent = $this->createMultipleCountriesContent();
112
113
        $query = new LocationQuery(
114
            [
115
                'query' => new Criterion\Field(
116
                    'countries',
117
                    Criterion\Operator::CONTAINS,
118
                    'Belgium'
119
                ),
120
            ]
121
        );
122
123
        $repository = $this->getRepository();
124
        $searchService = $repository->getSearchService();
125
        $result = $searchService->findLocations($query);
126
127
        $this->assertEquals(1, $result->totalCount);
128
        $this->assertEquals(
129
            $testContent->contentInfo->mainLocationId,
130
            $result->searchHits[0]->valueObject->id
131
        );
132
    }
133
134
    /**
135
     * Test for the findLocations() method.

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

@@ 1186-1209 (lines=24) @@
1183
     *
1184
     * @see \eZ\Publish\API\Repository\SearchService::findContent()
1185
     */
1186
    public function testFieldCollectionContains()
1187
    {
1188
        $testContent = $this->createMultipleCountriesContent();
1189
1190
        $query = new Query(
1191
            [
1192
                'query' => new Criterion\Field(
1193
                    'countries',
1194
                    Criterion\Operator::CONTAINS,
1195
                    'Belgium'
1196
                ),
1197
            ]
1198
        );
1199
1200
        $repository = $this->getRepository();
1201
        $searchService = $repository->getSearchService();
1202
        $result = $searchService->findContent($query);
1203
1204
        $this->assertEquals(1, $result->totalCount);
1205
        $this->assertEquals(
1206
            $testContent->id,
1207
            $result->searchHits[0]->valueObject->id
1208
        );
1209
    }
1210
1211
    /**
1212
     * Test for the findContent() method.