| @@ 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. |
|
| @@ 1323-1346 (lines=24) @@ | ||
| 1320 | * |
|
| 1321 | * @see \eZ\Publish\API\Repository\SearchService::findContent() |
|
| 1322 | */ |
|
| 1323 | public function testFieldCollectionContains() |
|
| 1324 | { |
|
| 1325 | $testContent = $this->createMultipleCountriesContent(); |
|
| 1326 | ||
| 1327 | $query = new Query( |
|
| 1328 | [ |
|
| 1329 | 'query' => new Criterion\Field( |
|
| 1330 | 'countries', |
|
| 1331 | Criterion\Operator::CONTAINS, |
|
| 1332 | 'Belgium' |
|
| 1333 | ), |
|
| 1334 | ] |
|
| 1335 | ); |
|
| 1336 | ||
| 1337 | $repository = $this->getRepository(); |
|
| 1338 | $searchService = $repository->getSearchService(); |
|
| 1339 | $result = $searchService->findContent($query); |
|
| 1340 | ||
| 1341 | $this->assertEquals(1, $result->totalCount); |
|
| 1342 | $this->assertEquals( |
|
| 1343 | $testContent->id, |
|
| 1344 | $result->searchHits[0]->valueObject->id |
|
| 1345 | ); |
|
| 1346 | } |
|
| 1347 | ||
| 1348 | /** |
|
| 1349 | * Test for the findContent() method. |
|