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