| @@ 187-212 (lines=26) @@ | ||
| 184 | * |
|
| 185 | * @see \eZ\Publish\API\Repository\SearchService::findLocations() |
|
| 186 | */ |
|
| 187 | public function testFieldIsEmptyInLocation() |
|
| 188 | { |
|
| 189 | $testContents = $this->createMovieContent(); |
|
| 190 | ||
| 191 | $query = new LocationQuery( |
|
| 192 | [ |
|
| 193 | 'query' => new Criterion\IsFieldEmpty('subtitle'), |
|
| 194 | ] |
|
| 195 | ); |
|
| 196 | ||
| 197 | $repository = $this->getRepository(); |
|
| 198 | $searchService = $repository->getSearchService(); |
|
| 199 | $result = $searchService->findLocations($query); |
|
| 200 | ||
| 201 | $this->assertEquals(2, $result->totalCount); |
|
| 202 | ||
| 203 | $this->assertEquals( |
|
| 204 | $testContents[0]->contentInfo->mainLocationId, |
|
| 205 | $result->searchHits[0]->valueObject->id |
|
| 206 | ); |
|
| 207 | ||
| 208 | $this->assertEquals( |
|
| 209 | $testContents[1]->contentInfo->mainLocationId, |
|
| 210 | $result->searchHits[1]->valueObject->id |
|
| 211 | ); |
|
| 212 | } |
|
| 213 | ||
| 214 | /** |
|
| 215 | * Test for the findLocations() method. |
|
| @@ 1261-1287 (lines=27) @@ | ||
| 1258 | * @return \eZ\Publish\API\Repository\Values\Content\Content[] |
|
| 1259 | * @see \eZ\Publish\API\Repository\SearchService::findContent() |
|
| 1260 | */ |
|
| 1261 | public function testFieldIsEmpty() |
|
| 1262 | { |
|
| 1263 | $testContents = $this->createMovieContent(); |
|
| 1264 | ||
| 1265 | $query = new Query( |
|
| 1266 | [ |
|
| 1267 | 'query' => new Criterion\IsFieldEmpty('subtitle'), |
|
| 1268 | ] |
|
| 1269 | ); |
|
| 1270 | ||
| 1271 | $repository = $this->getRepository(); |
|
| 1272 | $searchService = $repository->getSearchService(); |
|
| 1273 | $result = $searchService->findContent($query, ['eng-GB']); |
|
| 1274 | ||
| 1275 | $this->assertEquals(2, $result->totalCount); |
|
| 1276 | ||
| 1277 | $this->assertEquals( |
|
| 1278 | $testContents[0]->id, |
|
| 1279 | $result->searchHits[0]->valueObject->id |
|
| 1280 | ); |
|
| 1281 | $this->assertEquals( |
|
| 1282 | $testContents[1]->id, |
|
| 1283 | $result->searchHits[1]->valueObject->id |
|
| 1284 | ); |
|
| 1285 | ||
| 1286 | return $testContents; |
|
| 1287 | } |
|
| 1288 | ||
| 1289 | /** |
|
| 1290 | * Test for the findContent() method. |
|