Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 2738-2754 (lines=17) @@
2735
     * @covers \eZ\Publish\API\Repository\RoleService::removeRoleAssignment
2736
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
2737
     */
2738
    public function testUnassignRoleByAssignmentThrowsUnauthorizedException()
2739
    {
2740
        $repository = $this->getRepository();
2741
        $roleService = $repository->getRoleService();
2742
2743
        try {
2744
            $adminUserGroup = $repository->getUserService()->loadUserGroup(12);
2745
            $assignments = $roleService->getRoleAssignmentsForUserGroup($adminUserGroup);
2746
            $roleService->removeRoleAssignment($assignments[0]);
2747
        } catch (Exception $e) {
2748
            self::fail(
2749
                'Unexpected exception: ' . $e->getMessage() . " \n[" . $e->getFile() . ' (' . $e->getLine() . ')]'
2750
            );
2751
        }
2752
2753
        $roleService->removeRoleAssignment($assignments[0]);
2754
    }
2755
2756
    /**
2757
     * Test unassigning role by non-existing assignment.
@@ 2762-2778 (lines=17) @@
2759
     * @covers \eZ\Publish\API\Repository\RoleService::removeRoleAssignment
2760
     * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
2761
     */
2762
    public function testUnassignRoleByAssignmentThrowsNotFoundException()
2763
    {
2764
        $repository = $this->getRepository();
2765
        $roleService = $repository->getRoleService();
2766
2767
        try {
2768
            $editorsUserGroup = $repository->getUserService()->loadUserGroup(13);
2769
            $assignments = $roleService->getRoleAssignmentsForUserGroup($editorsUserGroup);
2770
            $roleService->removeRoleAssignment($assignments[0]);
2771
        } catch (Exception $e) {
2772
            self::fail(
2773
                'Unexpected exception: ' . $e->getMessage() . " \n[" . $e->getFile() . ' (' . $e->getLine() . ')]'
2774
            );
2775
        }
2776
2777
        $roleService->removeRoleAssignment($assignments[0]);
2778
    }
2779
2780
    /**
2781
     * Test for the getRoleAssignmentsForUserGroup() method.