| @@ 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. |
|
| @@ 1336-1351 (lines=16) @@ | ||
| 1333 | * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUser |
|
| 1334 | * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUser |
|
| 1335 | */ |
|
| 1336 | public function testDeleteUser() |
|
| 1337 | { |
|
| 1338 | $repository = $this->getRepository(); |
|
| 1339 | ||
| 1340 | $userService = $repository->getUserService(); |
|
| 1341 | ||
| 1342 | /* BEGIN: Use Case */ |
|
| 1343 | $user = $this->createUserVersion1(); |
|
| 1344 | ||
| 1345 | // Delete the currently created user |
|
| 1346 | $userService->deleteUser($user); |
|
| 1347 | /* END: Use Case */ |
|
| 1348 | ||
| 1349 | // We use the NotFoundException here to verify that the user not exists |
|
| 1350 | $userService->loadUser($user->id); |
|
| 1351 | } |
|
| 1352 | ||
| 1353 | /** |
|
| 1354 | * Test for the newUserUpdateStruct() method. |
|