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

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