| @@ 1714-1732 (lines=19) @@ | ||
| 1711 | * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException |
|
| 1712 | * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testAssignUserToUserGroup |
|
| 1713 | */ |
|
| 1714 | public function testAssignUserToUserGroupThrowsInvalidArgumentException() |
|
| 1715 | { |
|
| 1716 | $repository = $this->getRepository(); |
|
| 1717 | $userService = $repository->getUserService(); |
|
| 1718 | ||
| 1719 | $editorsGroupId = $this->generateId('group', 13); |
|
| 1720 | /* BEGIN: Use Case */ |
|
| 1721 | $user = $this->createUserVersion1(); |
|
| 1722 | // $editorsGroupId is the ID of the "Editors" group in an |
|
| 1723 | // eZ Publish demo installation |
|
| 1724 | ||
| 1725 | // This call will fail with an "InvalidArgumentException", because the |
|
| 1726 | // user is already assigned to the "Editors" group |
|
| 1727 | $userService->assignUserToUserGroup( |
|
| 1728 | $user, |
|
| 1729 | $userService->loadUserGroup($editorsGroupId) |
|
| 1730 | ); |
|
| 1731 | /* END: Use Case */ |
|
| 1732 | } |
|
| 1733 | ||
| 1734 | /** |
|
| 1735 | * Test for the unAssignUssrFromUserGroup() method. |
|
| @@ 63-79 (lines=17) @@ | ||
| 60 | * |
|
| 61 | * @throws \ErrorException if a mandatory test fixture not exists. |
|
| 62 | */ |
|
| 63 | public function testUserGroupLimitationForbid() |
|
| 64 | { |
|
| 65 | $repository = $this->getRepository(); |
|
| 66 | ||
| 67 | $userService = $repository->getUserService(); |
|
| 68 | ||
| 69 | /* BEGIN: Use Case */ |
|
| 70 | $user = $this->createUserVersion1(); |
|
| 71 | ||
| 72 | $userGroup = $this->prepareUserGroup(); |
|
| 73 | ||
| 74 | // Assign example user to new group |
|
| 75 | $userService->assignUserToUserGroup($user, $userGroup); |
|
| 76 | ||
| 77 | $this->prepareLimitationAndContent($user, $userGroup); |
|
| 78 | /* END: Use Case */ |
|
| 79 | } |
|
| 80 | ||
| 81 | /** |
|
| 82 | * Prepares the UserGroup fixture. |
|