|
@@ 2698-2714 (lines=17) @@
|
| 2695 |
|
* @covers \eZ\Publish\API\Repository\RoleService::removeRoleAssignment |
| 2696 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
| 2697 |
|
*/ |
| 2698 |
|
public function testUnassignRoleByAssignmentThrowsUnauthorizedException() |
| 2699 |
|
{ |
| 2700 |
|
$repository = $this->getRepository(); |
| 2701 |
|
$roleService = $repository->getRoleService(); |
| 2702 |
|
|
| 2703 |
|
try { |
| 2704 |
|
$adminUserGroup = $repository->getUserService()->loadUserGroup(12); |
| 2705 |
|
$assignments = $roleService->getRoleAssignmentsForUserGroup($adminUserGroup); |
| 2706 |
|
$roleService->removeRoleAssignment($assignments[0]); |
| 2707 |
|
} catch (Exception $e) { |
| 2708 |
|
self::fail( |
| 2709 |
|
'Unexpected exception: ' . $e->getMessage() . " \n[" . $e->getFile() . ' (' . $e->getLine() . ')]' |
| 2710 |
|
); |
| 2711 |
|
} |
| 2712 |
|
|
| 2713 |
|
$roleService->removeRoleAssignment($assignments[0]); |
| 2714 |
|
} |
| 2715 |
|
|
| 2716 |
|
/** |
| 2717 |
|
* Test unassigning role by non-existing assignment. |
|
@@ 2722-2738 (lines=17) @@
|
| 2719 |
|
* @covers \eZ\Publish\API\Repository\RoleService::removeRoleAssignment |
| 2720 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException |
| 2721 |
|
*/ |
| 2722 |
|
public function testUnassignRoleByAssignmentThrowsNotFoundException() |
| 2723 |
|
{ |
| 2724 |
|
$repository = $this->getRepository(); |
| 2725 |
|
$roleService = $repository->getRoleService(); |
| 2726 |
|
|
| 2727 |
|
try { |
| 2728 |
|
$editorsUserGroup = $repository->getUserService()->loadUserGroup(13); |
| 2729 |
|
$assignments = $roleService->getRoleAssignmentsForUserGroup($editorsUserGroup); |
| 2730 |
|
$roleService->removeRoleAssignment($assignments[0]); |
| 2731 |
|
} catch (Exception $e) { |
| 2732 |
|
self::fail( |
| 2733 |
|
'Unexpected exception: ' . $e->getMessage() . " \n[" . $e->getFile() . ' (' . $e->getLine() . ')]' |
| 2734 |
|
); |
| 2735 |
|
} |
| 2736 |
|
|
| 2737 |
|
$roleService->removeRoleAssignment($assignments[0]); |
| 2738 |
|
} |
| 2739 |
|
|
| 2740 |
|
/** |
| 2741 |
|
* Test for the getRoleAssignmentsForUserGroup() method. |