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