| @@ 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. |
|
| @@ 1290-1316 (lines=27) @@ | ||
| 1287 | * @return \eZ\Publish\API\Repository\Values\Content\Content[] |
|
| 1288 | * @see \eZ\Publish\API\Repository\SearchService::findContent() |
|
| 1289 | */ |
|
| 1290 | public function testFieldIsEmpty() |
|
| 1291 | { |
|
| 1292 | $testContents = $this->createMovieContent(); |
|
| 1293 | ||
| 1294 | $query = new Query( |
|
| 1295 | [ |
|
| 1296 | 'query' => new Criterion\IsFieldEmpty('subtitle'), |
|
| 1297 | ] |
|
| 1298 | ); |
|
| 1299 | ||
| 1300 | $repository = $this->getRepository(); |
|
| 1301 | $searchService = $repository->getSearchService(); |
|
| 1302 | $result = $searchService->findContent($query, ['eng-GB']); |
|
| 1303 | ||
| 1304 | $this->assertEquals(2, $result->totalCount); |
|
| 1305 | ||
| 1306 | $this->assertEquals( |
|
| 1307 | $testContents[0]->id, |
|
| 1308 | $result->searchHits[0]->valueObject->id |
|
| 1309 | ); |
|
| 1310 | $this->assertEquals( |
|
| 1311 | $testContents[1]->id, |
|
| 1312 | $result->searchHits[1]->valueObject->id |
|
| 1313 | ); |
|
| 1314 | ||
| 1315 | return $testContents; |
|
| 1316 | } |
|
| 1317 | ||
| 1318 | /** |
|
| 1319 | * Test for the findContent() method. |
|