eZ\Publish\Core\Repository\Tests\Service\Integration\RoleBase::testUnassignRoleFromUser PHP Метод

testUnassignRoleFromUser() публичный Метод

Test unassigning role from user.
    public function testUnassignRoleFromUser()
    {
        $roleService = $this->repository->getRoleService();
        $role = $roleService->loadRole(2);
        $user = $this->repository->getUserService()->loadUser(14);
        $originalAssignmentCount = count($roleService->getRoleAssignmentsForUser($user));
        $roleService->assignRoleToUser($role, $user);
        $newAssignmentCount = count($roleService->getRoleAssignmentsForUser($user));
        self::assertEquals($originalAssignmentCount + 1, $newAssignmentCount);
        $roleService->unassignRoleFromUser($role, $user);
        $finalAssignmentCount = count($roleService->getRoleAssignmentsForUser($user));
        self::assertEquals($newAssignmentCount - 1, $finalAssignmentCount);
    }