Code Duplication    Length = 16-16 lines in 2 locations

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

@@ 2231-2246 (lines=16) @@
2228
     * @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUser()
2229
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
2230
     */
2231
    public function testUnassignRoleFromUserThrowsInvalidArgumentException()
2232
    {
2233
        $repository = $this->getRepository();
2234
        $roleService = $repository->getRoleService();
2235
2236
        /* BEGIN: Use Case */
2237
        $user = $this->createUserVersion1();
2238
2239
        // Load the existing "Member" role
2240
        $role = $roleService->loadRoleByIdentifier('Member');
2241
2242
        // This call will fail with a "InvalidArgumentException", because the
2243
        // user does not have the "Member" role.
2244
        $roleService->unassignRoleFromUser($role, $user);
2245
        /* END: Use Case */
2246
    }
2247
2248
    /**
2249
     * Test for the getRoleAssignmentsForUser() method.
@@ 2682-2697 (lines=16) @@
2679
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
2680
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testUnassignRoleFromUserGroup
2681
     */
2682
    public function testUnassignRoleFromUserGroupThrowsInvalidArgumentException()
2683
    {
2684
        $repository = $this->getRepository();
2685
        $roleService = $repository->getRoleService();
2686
2687
        /* BEGIN: Use Case */
2688
        $userGroup = $this->createUserGroupVersion1();
2689
2690
        // Load the existing "Member" role
2691
        $role = $roleService->loadRoleByIdentifier('Member');
2692
2693
        // This call will fail with a "InvalidArgumentException", because the
2694
        // user group does not have the "Member" role.
2695
        $roleService->unassignRoleFromUserGroup($role, $userGroup);
2696
        /* END: Use Case */
2697
    }
2698
2699
    /**
2700
     * Test unassigning role by assignment.