Code Duplication    Length = 16-16 lines in 2 locations

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

@@ 2206-2221 (lines=16) @@
2203
     * @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUser()
2204
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
2205
     */
2206
    public function testUnassignRoleFromUserThrowsInvalidArgumentException()
2207
    {
2208
        $repository = $this->getRepository();
2209
        $roleService = $repository->getRoleService();
2210
2211
        /* BEGIN: Use Case */
2212
        $user = $this->createUserVersion1();
2213
2214
        // Load the existing "Member" role
2215
        $role = $roleService->loadRoleByIdentifier('Member');
2216
2217
        // This call will fail with a "InvalidArgumentException", because the
2218
        // user does not have the "Member" role.
2219
        $roleService->unassignRoleFromUser($role, $user);
2220
        /* END: Use Case */
2221
    }
2222
2223
    /**
2224
     * Test for the getRoleAssignmentsForUser() method.
@@ 2627-2642 (lines=16) @@
2624
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
2625
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testUnassignRoleFromUserGroup
2626
     */
2627
    public function testUnassignRoleFromUserGroupThrowsInvalidArgumentException()
2628
    {
2629
        $repository = $this->getRepository();
2630
        $roleService = $repository->getRoleService();
2631
2632
        /* BEGIN: Use Case */
2633
        $userGroup = $this->createUserGroupVersion1();
2634
2635
        // Load the existing "Member" role
2636
        $role = $roleService->loadRoleByIdentifier('Member');
2637
2638
        // This call will fail with a "InvalidArgumentException", because the
2639
        // user group does not have the "Member" role.
2640
        $roleService->unassignRoleFromUserGroup($role, $userGroup);
2641
        /* END: Use Case */
2642
    }
2643
2644
    /**
2645
     * Test unassigning role by assignment.