| @@ 94-117 (lines=24) @@ | ||
| 91 | * |
|
| 92 | * @see \eZ\Publish\API\Repository\SearchService::findLocations() |
|
| 93 | */ |
|
| 94 | public function testFieldCollectionContains() |
|
| 95 | { |
|
| 96 | $testContent = $this->createMultipleCountriesContent(); |
|
| 97 | ||
| 98 | $query = new LocationQuery( |
|
| 99 | array( |
|
| 100 | 'query' => new Criterion\Field( |
|
| 101 | 'countries', |
|
| 102 | Criterion\Operator::CONTAINS, |
|
| 103 | 'Belgium' |
|
| 104 | ), |
|
| 105 | ) |
|
| 106 | ); |
|
| 107 | ||
| 108 | $repository = $this->getRepository(); |
|
| 109 | $searchService = $repository->getSearchService(); |
|
| 110 | $result = $searchService->findLocations($query); |
|
| 111 | ||
| 112 | $this->assertEquals(1, $result->totalCount); |
|
| 113 | $this->assertEquals( |
|
| 114 | $testContent->contentInfo->mainLocationId, |
|
| 115 | $result->searchHits[0]->valueObject->id |
|
| 116 | ); |
|
| 117 | } |
|
| 118 | ||
| 119 | /** |
|
| 120 | * Test for the findLocations() method. |
|
| @@ 1183-1206 (lines=24) @@ | ||
| 1180 | * |
|
| 1181 | * @see \eZ\Publish\API\Repository\SearchService::findContent() |
|
| 1182 | */ |
|
| 1183 | public function testFieldCollectionContains() |
|
| 1184 | { |
|
| 1185 | $testContent = $this->createMultipleCountriesContent(); |
|
| 1186 | ||
| 1187 | $query = new Query( |
|
| 1188 | array( |
|
| 1189 | 'query' => new Criterion\Field( |
|
| 1190 | 'countries', |
|
| 1191 | Criterion\Operator::CONTAINS, |
|
| 1192 | 'Belgium' |
|
| 1193 | ), |
|
| 1194 | ) |
|
| 1195 | ); |
|
| 1196 | ||
| 1197 | $repository = $this->getRepository(); |
|
| 1198 | $searchService = $repository->getSearchService(); |
|
| 1199 | $result = $searchService->findContent($query); |
|
| 1200 | ||
| 1201 | $this->assertEquals(1, $result->totalCount); |
|
| 1202 | $this->assertEquals( |
|
| 1203 | $testContent->id, |
|
| 1204 | $result->searchHits[0]->valueObject->id |
|
| 1205 | ); |
|
| 1206 | } |
|
| 1207 | ||
| 1208 | /** |
|
| 1209 | * Test for the findContent() method. |
|