Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 2604-2620 (lines=17) @@
2601
     * @covers \eZ\Publish\API\Repository\RoleService::removeRoleAssignment
2602
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
2603
     */
2604
    public function testUnassignRoleByAssignmentThrowsUnauthorizedException()
2605
    {
2606
        $repository = $this->getRepository();
2607
        $roleService = $repository->getRoleService();
2608
2609
        try {
2610
            $adminUserGroup = $repository->getUserService()->loadUserGroup(12);
2611
            $assignments = $roleService->getRoleAssignmentsForUserGroup($adminUserGroup);
2612
            $roleService->removeRoleAssignment($assignments[0]);
2613
        } catch (Exception $e) {
2614
            self::fail(
2615
                'Unexpected exception: ' . $e->getMessage() . " \n[" . $e->getFile() . ' (' . $e->getLine() . ')]'
2616
            );
2617
        }
2618
2619
        $roleService->removeRoleAssignment($assignments[0]);
2620
    }
2621
2622
    /**
2623
     * Test unassigning role by non-existing assignment.
@@ 2628-2644 (lines=17) @@
2625
     * @covers \eZ\Publish\API\Repository\RoleService::removeRoleAssignment
2626
     * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
2627
     */
2628
    public function testUnassignRoleByAssignmentThrowsNotFoundException()
2629
    {
2630
        $repository = $this->getRepository();
2631
        $roleService = $repository->getRoleService();
2632
2633
        try {
2634
            $editorsUserGroup = $repository->getUserService()->loadUserGroup(13);
2635
            $assignments = $roleService->getRoleAssignmentsForUserGroup($editorsUserGroup);
2636
            $roleService->removeRoleAssignment($assignments[0]);
2637
        } catch (Exception $e) {
2638
            self::fail(
2639
                'Unexpected exception: ' . $e->getMessage() . " \n[" . $e->getFile() . ' (' . $e->getLine() . ')]'
2640
            );
2641
        }
2642
2643
        $roleService->removeRoleAssignment($assignments[0]);
2644
    }
2645
2646
    /**
2647
     * Test for the getRoleAssignmentsForUserGroup() method.