Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 2673-2689 (lines=17) @@
2670
     * @covers \eZ\Publish\API\Repository\RoleService::removeRoleAssignment
2671
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
2672
     */
2673
    public function testUnassignRoleByAssignmentThrowsUnauthorizedException()
2674
    {
2675
        $repository = $this->getRepository();
2676
        $roleService = $repository->getRoleService();
2677
2678
        try {
2679
            $adminUserGroup = $repository->getUserService()->loadUserGroup(12);
2680
            $assignments = $roleService->getRoleAssignmentsForUserGroup($adminUserGroup);
2681
            $roleService->removeRoleAssignment($assignments[0]);
2682
        } catch (Exception $e) {
2683
            self::fail(
2684
                'Unexpected exception: ' . $e->getMessage() . " \n[" . $e->getFile() . ' (' . $e->getLine() . ')]'
2685
            );
2686
        }
2687
2688
        $roleService->removeRoleAssignment($assignments[0]);
2689
    }
2690
2691
    /**
2692
     * Test unassigning role by non-existing assignment.
@@ 2697-2713 (lines=17) @@
2694
     * @covers \eZ\Publish\API\Repository\RoleService::removeRoleAssignment
2695
     * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
2696
     */
2697
    public function testUnassignRoleByAssignmentThrowsNotFoundException()
2698
    {
2699
        $repository = $this->getRepository();
2700
        $roleService = $repository->getRoleService();
2701
2702
        try {
2703
            $editorsUserGroup = $repository->getUserService()->loadUserGroup(13);
2704
            $assignments = $roleService->getRoleAssignmentsForUserGroup($editorsUserGroup);
2705
            $roleService->removeRoleAssignment($assignments[0]);
2706
        } catch (Exception $e) {
2707
            self::fail(
2708
                'Unexpected exception: ' . $e->getMessage() . " \n[" . $e->getFile() . ' (' . $e->getLine() . ')]'
2709
            );
2710
        }
2711
2712
        $roleService->removeRoleAssignment($assignments[0]);
2713
    }
2714
2715
    /**
2716
     * Test for the getRoleAssignmentsForUserGroup() method.