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