| @@ 186-197 (lines=12) @@ | ||
| 183 | * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion |
|
| 184 | * @param int $totalCount |
|
| 185 | */ |
|
| 186 | public function testMatchAllLocationQuery($criterion, $totalCount) |
|
| 187 | { |
|
| 188 | $query = new LocationQuery( |
|
| 189 | [ |
|
| 190 | 'query' => $criterion, |
|
| 191 | ] |
|
| 192 | ); |
|
| 193 | ||
| 194 | $result = $this->getRepository()->getSearchService()->findLocations($query); |
|
| 195 | ||
| 196 | $this->assertEquals($totalCount, $result->totalCount); |
|
| 197 | } |
|
| 198 | ||
| 199 | /** |
|
| 200 | * @dataProvider providerForTestMatchAll |
|
| @@ 205-216 (lines=12) @@ | ||
| 202 | * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion |
|
| 203 | * @param int $totalCount |
|
| 204 | */ |
|
| 205 | public function testMatchAllLocationFilter($criterion, $totalCount) |
|
| 206 | { |
|
| 207 | $query = new LocationQuery( |
|
| 208 | [ |
|
| 209 | 'filter' => $criterion, |
|
| 210 | ] |
|
| 211 | ); |
|
| 212 | ||
| 213 | $result = $this->getRepository()->getSearchService()->findLocations($query); |
|
| 214 | ||
| 215 | $this->assertEquals($totalCount, $result->totalCount); |
|
| 216 | } |
|
| 217 | } |
|
| 218 | ||
| @@ 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. |
|