| @@ 242-256 (lines=15) @@ | ||
| 239 | * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
|
| 240 | * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testDeleteUser |
|
| 241 | */ |
|
| 242 | public function testDeleteUserThrowsUnauthorizedException() |
|
| 243 | { |
|
| 244 | $repository = $this->getRepository(); |
|
| 245 | $userService = $repository->getUserService(); |
|
| 246 | ||
| 247 | /* BEGIN: Use Case */ |
|
| 248 | $user = $this->createUserVersion1(); |
|
| 249 | ||
| 250 | // Now set the currently created "Editor" as current user |
|
| 251 | $repository->setCurrentUser($user); |
|
| 252 | ||
| 253 | // This call will fail with an "UnauthorizedException" |
|
| 254 | $userService->deleteUser($user); |
|
| 255 | /* END: Use Case */ |
|
| 256 | } |
|
| 257 | ||
| 258 | /** |
|
| 259 | * Test for the updateUser() method. |
|
| @@ 359-374 (lines=16) @@ | ||
| 356 | * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
|
| 357 | * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserGroupsOfUser |
|
| 358 | */ |
|
| 359 | public function testLoadUserGroupsOfUserThrowsUnauthorizedException() |
|
| 360 | { |
|
| 361 | $repository = $this->getRepository(); |
|
| 362 | ||
| 363 | $userService = $repository->getUserService(); |
|
| 364 | ||
| 365 | /* BEGIN: Use Case */ |
|
| 366 | $user = $this->createUserVersion1(); |
|
| 367 | ||
| 368 | // Now set the currently created "Editor" as current user |
|
| 369 | $repository->setCurrentUser($user); |
|
| 370 | ||
| 371 | // This call will fail with an "UnauthorizedException" |
|
| 372 | $userService->loadUserGroupsOfUser($user); |
|
| 373 | /* END: Use Case */ |
|
| 374 | } |
|
| 375 | ||
| 376 | /** |
|
| 377 | * Test for the loadUsersOfUserGroup() method. |
|
| @@ 1490-1505 (lines=16) @@ | ||
| 1487 | * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUser |
|
| 1488 | * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUser |
|
| 1489 | */ |
|
| 1490 | public function testDeleteUser() |
|
| 1491 | { |
|
| 1492 | $repository = $this->getRepository(); |
|
| 1493 | ||
| 1494 | $userService = $repository->getUserService(); |
|
| 1495 | ||
| 1496 | /* BEGIN: Use Case */ |
|
| 1497 | $user = $this->createUserVersion1(); |
|
| 1498 | ||
| 1499 | // Delete the currently created user |
|
| 1500 | $userService->deleteUser($user); |
|
| 1501 | /* END: Use Case */ |
|
| 1502 | ||
| 1503 | // We use the NotFoundException here to verify that the user not exists |
|
| 1504 | $userService->loadUser($user->id); |
|
| 1505 | } |
|
| 1506 | ||
| 1507 | /** |
|
| 1508 | * Test for the newUserUpdateStruct() method. |
|