Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 2635-2651 (lines=17) @@
2632
     * @covers \eZ\Publish\API\Repository\RoleService::removeRoleAssignment
2633
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
2634
     */
2635
    public function testUnassignRoleByAssignmentThrowsUnauthorizedException()
2636
    {
2637
        $repository = $this->getRepository();
2638
        $roleService = $repository->getRoleService();
2639
2640
        try {
2641
            $adminUserGroup = $repository->getUserService()->loadUserGroup(12);
2642
            $assignments = $roleService->getRoleAssignmentsForUserGroup($adminUserGroup);
2643
            $roleService->removeRoleAssignment($assignments[0]);
2644
        } catch (Exception $e) {
2645
            self::fail(
2646
                'Unexpected exception: ' . $e->getMessage() . " \n[" . $e->getFile() . ' (' . $e->getLine() . ')]'
2647
            );
2648
        }
2649
2650
        $roleService->removeRoleAssignment($assignments[0]);
2651
    }
2652
2653
    /**
2654
     * Test unassigning role by non-existing assignment.
@@ 2659-2675 (lines=17) @@
2656
     * @covers \eZ\Publish\API\Repository\RoleService::removeRoleAssignment
2657
     * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
2658
     */
2659
    public function testUnassignRoleByAssignmentThrowsNotFoundException()
2660
    {
2661
        $repository = $this->getRepository();
2662
        $roleService = $repository->getRoleService();
2663
2664
        try {
2665
            $editorsUserGroup = $repository->getUserService()->loadUserGroup(13);
2666
            $assignments = $roleService->getRoleAssignmentsForUserGroup($editorsUserGroup);
2667
            $roleService->removeRoleAssignment($assignments[0]);
2668
        } catch (Exception $e) {
2669
            self::fail(
2670
                'Unexpected exception: ' . $e->getMessage() . " \n[" . $e->getFile() . ' (' . $e->getLine() . ')]'
2671
            );
2672
        }
2673
2674
        $roleService->removeRoleAssignment($assignments[0]);
2675
    }
2676
2677
    /**
2678
     * Test for the getRoleAssignmentsForUserGroup() method.