Code Duplication    Length = 16-16 lines in 2 locations

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

@@ 2227-2242 (lines=16) @@
2224
     * @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUser()
2225
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
2226
     */
2227
    public function testUnassignRoleFromUserThrowsInvalidArgumentException()
2228
    {
2229
        $repository = $this->getRepository();
2230
        $roleService = $repository->getRoleService();
2231
2232
        /* BEGIN: Use Case */
2233
        $user = $this->createUserVersion1();
2234
2235
        // Load the existing "Member" role
2236
        $role = $roleService->loadRoleByIdentifier('Member');
2237
2238
        // This call will fail with a "InvalidArgumentException", because the
2239
        // user does not have the "Member" role.
2240
        $roleService->unassignRoleFromUser($role, $user);
2241
        /* END: Use Case */
2242
    }
2243
2244
    /**
2245
     * Test for the getRoleAssignmentsForUser() method.
@@ 2648-2663 (lines=16) @@
2645
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
2646
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testUnassignRoleFromUserGroup
2647
     */
2648
    public function testUnassignRoleFromUserGroupThrowsInvalidArgumentException()
2649
    {
2650
        $repository = $this->getRepository();
2651
        $roleService = $repository->getRoleService();
2652
2653
        /* BEGIN: Use Case */
2654
        $userGroup = $this->createUserGroupVersion1();
2655
2656
        // Load the existing "Member" role
2657
        $role = $roleService->loadRoleByIdentifier('Member');
2658
2659
        // This call will fail with a "InvalidArgumentException", because the
2660
        // user group does not have the "Member" role.
2661
        $roleService->unassignRoleFromUserGroup($role, $userGroup);
2662
        /* END: Use Case */
2663
    }
2664
2665
    /**
2666
     * Test unassigning role by assignment.