|
@@ 2203-2226 (lines=24) @@
|
| 2200 |
|
* @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUser() |
| 2201 |
|
* @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUser |
| 2202 |
|
*/ |
| 2203 |
|
public function testUnassignRoleFromUser() |
| 2204 |
|
{ |
| 2205 |
|
$repository = $this->getRepository(); |
| 2206 |
|
$roleService = $repository->getRoleService(); |
| 2207 |
|
|
| 2208 |
|
/* BEGIN: Use Case */ |
| 2209 |
|
$user = $this->createUserVersion1(); |
| 2210 |
|
|
| 2211 |
|
// Load the existing "Member" role |
| 2212 |
|
$role = $roleService->loadRoleByIdentifier('Member'); |
| 2213 |
|
|
| 2214 |
|
// Assign the "Member" role to the newly created user |
| 2215 |
|
$roleService->assignRoleToUser($role, $user); |
| 2216 |
|
|
| 2217 |
|
// Unassign user from role |
| 2218 |
|
$roleService->unassignRoleFromUser($role, $user); |
| 2219 |
|
|
| 2220 |
|
// The assignments array will not contain the new role<->user assignment |
| 2221 |
|
$roleAssignments = $roleService->getRoleAssignments($role); |
| 2222 |
|
/* END: Use Case */ |
| 2223 |
|
|
| 2224 |
|
// Members + Editors + Partners |
| 2225 |
|
$this->assertEquals(3, count($roleAssignments)); |
| 2226 |
|
} |
| 2227 |
|
|
| 2228 |
|
/** |
| 2229 |
|
* Test for the unassignRoleFromUser() method. |
|
@@ 2658-2681 (lines=24) @@
|
| 2655 |
|
* @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUserGroup() |
| 2656 |
|
* @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUserGroup |
| 2657 |
|
*/ |
| 2658 |
|
public function testUnassignRoleFromUserGroup() |
| 2659 |
|
{ |
| 2660 |
|
$repository = $this->getRepository(); |
| 2661 |
|
$roleService = $repository->getRoleService(); |
| 2662 |
|
|
| 2663 |
|
/* BEGIN: Use Case */ |
| 2664 |
|
$userGroup = $this->createUserGroupVersion1(); |
| 2665 |
|
|
| 2666 |
|
// Load the existing "Member" role |
| 2667 |
|
$role = $roleService->loadRoleByIdentifier('Member'); |
| 2668 |
|
|
| 2669 |
|
// Assign the "Member" role to the newly created user group |
| 2670 |
|
$roleService->assignRoleToUserGroup($role, $userGroup); |
| 2671 |
|
|
| 2672 |
|
// Unassign group from role |
| 2673 |
|
$roleService->unassignRoleFromUserGroup($role, $userGroup); |
| 2674 |
|
|
| 2675 |
|
// The assignments array will not contain the new role<->group assignment |
| 2676 |
|
$roleAssignments = $roleService->getRoleAssignments($role); |
| 2677 |
|
/* END: Use Case */ |
| 2678 |
|
|
| 2679 |
|
// Members + Editors + Partners |
| 2680 |
|
$this->assertEquals(3, count($roleAssignments)); |
| 2681 |
|
} |
| 2682 |
|
|
| 2683 |
|
/** |
| 2684 |
|
* Test for the unassignRoleFromUserGroup() method. |