Code Duplication    Length = 17-17 lines in 2 locations

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

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