| @@ 105-113 (lines=9) @@ | ||
| 102 | * @param $subtreePathString |
|
| 103 | * @return int|null |
|
| 104 | */ |
|
| 105 | protected function getSubtreeLocationsCount($subtreePathString) |
|
| 106 | { |
|
| 107 | $criterion = new Criterion\Subtree($subtreePathString); |
|
| 108 | $query = new LocationQuery(['filter' => $criterion]); |
|
| 109 | ||
| 110 | $result = $this->getRepository()->getSearchService()->findLocations($query); |
|
| 111 | ||
| 112 | return $result->totalCount; |
|
| 113 | } |
|
| 114 | ||
| 115 | /** |
|
| 116 | * Create test User in the given User Group. |
|
| @@ 260-271 (lines=12) @@ | ||
| 257 | * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion |
|
| 258 | * @param int $totalCount |
|
| 259 | */ |
|
| 260 | public function testMatchAllLocationQuery($criterion, $totalCount) |
|
| 261 | { |
|
| 262 | $query = new LocationQuery( |
|
| 263 | [ |
|
| 264 | 'query' => $criterion, |
|
| 265 | ] |
|
| 266 | ); |
|
| 267 | ||
| 268 | $result = $this->getRepository()->getSearchService()->findLocations($query); |
|
| 269 | ||
| 270 | $this->assertEquals($totalCount, $result->totalCount); |
|
| 271 | } |
|
| 272 | ||
| 273 | /** |
|
| 274 | * @dataProvider providerForTestMatchAll |
|
| @@ 279-290 (lines=12) @@ | ||
| 276 | * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion |
|
| 277 | * @param int $totalCount |
|
| 278 | */ |
|
| 279 | public function testMatchAllLocationFilter($criterion, $totalCount) |
|
| 280 | { |
|
| 281 | $query = new LocationQuery( |
|
| 282 | [ |
|
| 283 | 'filter' => $criterion, |
|
| 284 | ] |
|
| 285 | ); |
|
| 286 | ||
| 287 | $result = $this->getRepository()->getSearchService()->findLocations($query); |
|
| 288 | ||
| 289 | $this->assertEquals($totalCount, $result->totalCount); |
|
| 290 | } |
|
| 291 | } |
|
| 292 | ||