|
@@ 288-307 (lines=20) @@
|
| 285 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
| 286 |
|
* @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testHideLocation |
| 287 |
|
*/ |
| 288 |
|
public function testHideLocationThrowsUnauthorizedException() |
| 289 |
|
{ |
| 290 |
|
$repository = $this->getRepository(); |
| 291 |
|
|
| 292 |
|
$editorsGroupId = $this->generateId('group', 13); |
| 293 |
|
|
| 294 |
|
/* BEGIN: Use Case */ |
| 295 |
|
$user = $this->createUserVersion1(); |
| 296 |
|
|
| 297 |
|
$locationService = $repository->getLocationService(); |
| 298 |
|
|
| 299 |
|
$visibleLocation = $locationService->loadLocation($editorsGroupId); |
| 300 |
|
|
| 301 |
|
// Set current user to newly created user |
| 302 |
|
$repository->setCurrentUser($user); |
| 303 |
|
|
| 304 |
|
// This call will fail with an "UnauthorizedException" |
| 305 |
|
$locationService->hideLocation($visibleLocation); |
| 306 |
|
/* END: Use Case */ |
| 307 |
|
} |
| 308 |
|
|
| 309 |
|
/** |
| 310 |
|
* Test for the unhideLocation() method. |
|
@@ 347-366 (lines=20) @@
|
| 344 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
| 345 |
|
* @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testDeleteLocation |
| 346 |
|
*/ |
| 347 |
|
public function testDeleteLocationThrowsUnauthorizedException() |
| 348 |
|
{ |
| 349 |
|
$repository = $this->getRepository(); |
| 350 |
|
|
| 351 |
|
$editorsGroupId = $this->generateId('group', 13); |
| 352 |
|
|
| 353 |
|
/* BEGIN: Use Case */ |
| 354 |
|
$user = $this->createUserVersion1(); |
| 355 |
|
|
| 356 |
|
$locationService = $repository->getLocationService(); |
| 357 |
|
|
| 358 |
|
$location = $locationService->loadLocation($editorsGroupId); |
| 359 |
|
|
| 360 |
|
// Set current user to newly created user |
| 361 |
|
$repository->setCurrentUser($user); |
| 362 |
|
|
| 363 |
|
// This call will fail with an "UnauthorizedException" |
| 364 |
|
$locationService->deleteLocation($location); |
| 365 |
|
/* END: Use Case */ |
| 366 |
|
} |
| 367 |
|
|
| 368 |
|
/** |
| 369 |
|
* Test for the deleteLocation() method. |