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

@@ 1167-1190 (lines=24) @@
1164
     *
1165
     * @see \eZ\Publish\API\Repository\SearchService::findContent()
1166
     */
1167
    public function testFieldCollectionContains()
1168
    {
1169
        $testContent = $this->createMultipleCountriesContent();
1170
1171
        $query = new Query(
1172
            array(
1173
                'query' => new Criterion\Field(
1174
                    'countries',
1175
                    Criterion\Operator::CONTAINS,
1176
                    'Belgium'
1177
                ),
1178
            )
1179
        );
1180
1181
        $repository = $this->getRepository();
1182
        $searchService = $repository->getSearchService();
1183
        $result = $searchService->findContent($query);
1184
1185
        $this->assertEquals(1, $result->totalCount);
1186
        $this->assertEquals(
1187
            $testContent->id,
1188
            $result->searchHits[0]->valueObject->id
1189
        );
1190
    }
1191
1192
    /**
1193
     * Test for the findContent() method.