| @@ 1680-1698 (lines=19) @@ | ||
| 1677 | * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException |
|
| 1678 | * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testAssignUserToUserGroup |
|
| 1679 | */ |
|
| 1680 | public function testAssignUserToUserGroupThrowsInvalidArgumentException() |
|
| 1681 | { |
|
| 1682 | $repository = $this->getRepository(); |
|
| 1683 | $userService = $repository->getUserService(); |
|
| 1684 | ||
| 1685 | $editorsGroupId = $this->generateId('group', 13); |
|
| 1686 | /* BEGIN: Use Case */ |
|
| 1687 | $user = $this->createUserVersion1(); |
|
| 1688 | // $editorsGroupId is the ID of the "Editors" group in an |
|
| 1689 | // eZ Publish demo installation |
|
| 1690 | ||
| 1691 | // This call will fail with an "InvalidArgumentException", because the |
|
| 1692 | // user is already assigned to the "Editors" group |
|
| 1693 | $userService->assignUserToUserGroup( |
|
| 1694 | $user, |
|
| 1695 | $userService->loadUserGroup($editorsGroupId) |
|
| 1696 | ); |
|
| 1697 | /* END: Use Case */ |
|
| 1698 | } |
|
| 1699 | ||
| 1700 | /** |
|
| 1701 | * Test for the unAssignUssrFromUserGroup() method. |
|
| @@ 65-81 (lines=17) @@ | ||
| 62 | * |
|
| 63 | * @throws \ErrorException if a mandatory test fixture not exists. |
|
| 64 | */ |
|
| 65 | public function testUserGroupLimitationForbid() |
|
| 66 | { |
|
| 67 | $repository = $this->getRepository(); |
|
| 68 | ||
| 69 | $userService = $repository->getUserService(); |
|
| 70 | ||
| 71 | /* BEGIN: Use Case */ |
|
| 72 | $user = $this->createUserVersion1(); |
|
| 73 | ||
| 74 | $userGroup = $this->prepareUserGroup(); |
|
| 75 | ||
| 76 | // Assign example user to new group |
|
| 77 | $userService->assignUserToUserGroup($user, $userGroup); |
|
| 78 | ||
| 79 | $this->prepareLimitationAndContent($user, $userGroup); |
|
| 80 | /* END: Use Case */ |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * Prepares the UserGroup fixture. |
|