| @@ 188-213 (lines=26) @@ | ||
| 185 | * |
|
| 186 | * @see \eZ\Publish\API\Repository\SearchService::findLocations() |
|
| 187 | */ |
|
| 188 | public function testFieldIsEmptyInLocation() |
|
| 189 | { |
|
| 190 | $testContents = $this->createMovieContent(); |
|
| 191 | ||
| 192 | $query = new LocationQuery( |
|
| 193 | [ |
|
| 194 | 'query' => new Criterion\IsFieldEmpty('subtitle'), |
|
| 195 | ] |
|
| 196 | ); |
|
| 197 | ||
| 198 | $repository = $this->getRepository(); |
|
| 199 | $searchService = $repository->getSearchService(); |
|
| 200 | $result = $searchService->findLocations($query); |
|
| 201 | ||
| 202 | $this->assertEquals(2, $result->totalCount); |
|
| 203 | ||
| 204 | $this->assertEquals( |
|
| 205 | $testContents[0]->contentInfo->mainLocationId, |
|
| 206 | $result->searchHits[0]->valueObject->id |
|
| 207 | ); |
|
| 208 | ||
| 209 | $this->assertEquals( |
|
| 210 | $testContents[1]->contentInfo->mainLocationId, |
|
| 211 | $result->searchHits[1]->valueObject->id |
|
| 212 | ); |
|
| 213 | } |
|
| 214 | ||
| 215 | /** |
|
| 216 | * Test for the findLocations() method. |
|
| @@ 1295-1321 (lines=27) @@ | ||
| 1292 | * |
|
| 1293 | * @see \eZ\Publish\API\Repository\SearchService::findContent() |
|
| 1294 | */ |
|
| 1295 | public function testFieldIsEmpty() |
|
| 1296 | { |
|
| 1297 | $testContents = $this->createMovieContent(); |
|
| 1298 | ||
| 1299 | $query = new Query( |
|
| 1300 | [ |
|
| 1301 | 'query' => new Criterion\IsFieldEmpty('subtitle'), |
|
| 1302 | ] |
|
| 1303 | ); |
|
| 1304 | ||
| 1305 | $repository = $this->getRepository(); |
|
| 1306 | $searchService = $repository->getSearchService(); |
|
| 1307 | $result = $searchService->findContent($query, ['eng-GB']); |
|
| 1308 | ||
| 1309 | $this->assertEquals(2, $result->totalCount); |
|
| 1310 | ||
| 1311 | $this->assertEquals( |
|
| 1312 | $testContents[0]->id, |
|
| 1313 | $result->searchHits[0]->valueObject->id |
|
| 1314 | ); |
|
| 1315 | $this->assertEquals( |
|
| 1316 | $testContents[1]->id, |
|
| 1317 | $result->searchHits[1]->valueObject->id |
|
| 1318 | ); |
|
| 1319 | ||
| 1320 | return $testContents; |
|
| 1321 | } |
|
| 1322 | ||
| 1323 | /** |
|
| 1324 | * Test for the findContent() method. |
|