Code Duplication    Length = 17-17 lines in 2 locations

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

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