Code Duplication    Length = 17-17 lines in 2 locations

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

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