|
@@ 2186-2201 (lines=16) @@
|
| 2183 |
|
* @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUser() |
| 2184 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException |
| 2185 |
|
*/ |
| 2186 |
|
public function testUnassignRoleFromUserThrowsInvalidArgumentException() |
| 2187 |
|
{ |
| 2188 |
|
$repository = $this->getRepository(); |
| 2189 |
|
$roleService = $repository->getRoleService(); |
| 2190 |
|
|
| 2191 |
|
/* BEGIN: Use Case */ |
| 2192 |
|
$user = $this->createUserVersion1(); |
| 2193 |
|
|
| 2194 |
|
// Load the existing "Member" role |
| 2195 |
|
$role = $roleService->loadRoleByIdentifier('Member'); |
| 2196 |
|
|
| 2197 |
|
// This call will fail with a "InvalidArgumentException", because the |
| 2198 |
|
// user does not have the "Member" role. |
| 2199 |
|
$roleService->unassignRoleFromUser($role, $user); |
| 2200 |
|
/* END: Use Case */ |
| 2201 |
|
} |
| 2202 |
|
|
| 2203 |
|
/** |
| 2204 |
|
* Test for the getRoleAssignmentsForUser() method. |
|
@@ 2637-2652 (lines=16) @@
|
| 2634 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException |
| 2635 |
|
* @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testUnassignRoleFromUserGroup |
| 2636 |
|
*/ |
| 2637 |
|
public function testUnassignRoleFromUserGroupThrowsInvalidArgumentException() |
| 2638 |
|
{ |
| 2639 |
|
$repository = $this->getRepository(); |
| 2640 |
|
$roleService = $repository->getRoleService(); |
| 2641 |
|
|
| 2642 |
|
/* BEGIN: Use Case */ |
| 2643 |
|
$userGroup = $this->createUserGroupVersion1(); |
| 2644 |
|
|
| 2645 |
|
// Load the existing "Member" role |
| 2646 |
|
$role = $roleService->loadRoleByIdentifier('Member'); |
| 2647 |
|
|
| 2648 |
|
// This call will fail with a "InvalidArgumentException", because the |
| 2649 |
|
// user group does not have the "Member" role. |
| 2650 |
|
$roleService->unassignRoleFromUserGroup($role, $userGroup); |
| 2651 |
|
/* END: Use Case */ |
| 2652 |
|
} |
| 2653 |
|
|
| 2654 |
|
/** |
| 2655 |
|
* Test unassigning role by assignment. |