Code Duplication    Length = 17-17 lines in 2 locations

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

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