| @@ 244-258 (lines=15) @@ | ||
| 241 | * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
|
| 242 | * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testDeleteUser |
|
| 243 | */ |
|
| 244 | public function testDeleteUserThrowsUnauthorizedException() |
|
| 245 | { |
|
| 246 | $repository = $this->getRepository(); |
|
| 247 | $userService = $repository->getUserService(); |
|
| 248 | ||
| 249 | /* BEGIN: Use Case */ |
|
| 250 | $user = $this->createUserVersion1(); |
|
| 251 | ||
| 252 | // Now set the currently created "Editor" as current user |
|
| 253 | $repository->setCurrentUser($user); |
|
| 254 | ||
| 255 | // This call will fail with an "UnauthorizedException" |
|
| 256 | $userService->deleteUser($user); |
|
| 257 | /* END: Use Case */ |
|
| 258 | } |
|
| 259 | ||
| 260 | /** |
|
| 261 | * Test for the updateUser() method. |
|
| @@ 361-376 (lines=16) @@ | ||
| 358 | * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
|
| 359 | * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserGroupsOfUser |
|
| 360 | */ |
|
| 361 | public function testLoadUserGroupsOfUserThrowsUnauthorizedException() |
|
| 362 | { |
|
| 363 | $repository = $this->getRepository(); |
|
| 364 | ||
| 365 | $userService = $repository->getUserService(); |
|
| 366 | ||
| 367 | /* BEGIN: Use Case */ |
|
| 368 | $user = $this->createUserVersion1(); |
|
| 369 | ||
| 370 | // Now set the currently created "Editor" as current user |
|
| 371 | $repository->setCurrentUser($user); |
|
| 372 | ||
| 373 | // This call will fail with an "UnauthorizedException" |
|
| 374 | $userService->loadUserGroupsOfUser($user); |
|
| 375 | /* END: Use Case */ |
|
| 376 | } |
|
| 377 | ||
| 378 | /** |
|
| 379 | * Test for the loadUsersOfUserGroup() method. |
|
| @@ 1300-1315 (lines=16) @@ | ||
| 1297 | * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUser |
|
| 1298 | * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUser |
|
| 1299 | */ |
|
| 1300 | public function testDeleteUser() |
|
| 1301 | { |
|
| 1302 | $repository = $this->getRepository(); |
|
| 1303 | ||
| 1304 | $userService = $repository->getUserService(); |
|
| 1305 | ||
| 1306 | /* BEGIN: Use Case */ |
|
| 1307 | $user = $this->createUserVersion1(); |
|
| 1308 | ||
| 1309 | // Delete the currently created user |
|
| 1310 | $userService->deleteUser($user); |
|
| 1311 | /* END: Use Case */ |
|
| 1312 | ||
| 1313 | // We use the NotFoundException here to verify that the user not exists |
|
| 1314 | $userService->loadUser($user->id); |
|
| 1315 | } |
|
| 1316 | ||
| 1317 | /** |
|
| 1318 | * Test for the newUserUpdateStruct() method. |
|