Code Duplication    Length = 17-17 lines in 2 locations

eZ/Publish/API/Repository/Tests/RoleServiceTest.php 2 locations

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