Commit db27d795 authored by xjm's avatar xjm

Issue #2322195 by rpayanm, nlisgo, cilefen, balagan, LinL, akashjain132,...

Issue #2322195 by rpayanm, nlisgo, cilefen, balagan, LinL, akashjain132, filijonka, epari.siva, Tebro, Temoor, pcambra, unstatu, Poornima3, Shivam Agarwal, abhi170893, Dom., PieterJanPut, Mile23, JeroenT, disasm: Replace all instances of user_load(), user_load_multiple(), entity_load('user') and entity_load_multiple('user') with static method calls
parent d0ac1056
......@@ -26,7 +26,7 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Route;
use Drupal\user\Entity\User;
use GuzzleHttp\Exception\RequestException;
/**
......@@ -1851,7 +1851,7 @@ function install_finished(&$install_state) {
// Load current user and perform final login tasks.
// This has to be done after drupal_flush_all_caches()
// to avoid session regeneration.
$account = user_load(1);
$account = User::load(1);
user_login_finalize($account);
}
......
......@@ -40,7 +40,7 @@
* // Load a node and a user, then replace tokens in the text.
* $text = 'On [date:short], [user:name] read [node:title].';
* $node = Node::load(1);
* $user = user_load(1);
* $user = User::load(1);
*
* // [date:...] tokens use the current date automatically.
* $data = array('node' => $node, 'user' => $user);
......
......@@ -9,6 +9,7 @@
use Drupal\views\Tests\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
use Drupal\user\Entity\User;
/**
* Tests the contact link field.
......@@ -55,7 +56,7 @@ protected function setUp() {
*/
public function testContactLink() {
$accounts = array();
$accounts['root'] = user_load(1);
$accounts['root'] = User::load(1);
// Create an account with access to all contact pages.
$admin_account = $this->drupalCreateUser(array('administer users'));
$accounts['admin'] = $admin_account;
......
......@@ -11,6 +11,7 @@
use Drupal\content_translation\Tests\ContentTranslationTestBase;
use Drupal\views\Tests\ViewTestData;
use Drupal\Core\Language\Language;
use Drupal\user\Entity\User;
/**
* Tests the content translation overview link field handler.
......@@ -41,12 +42,12 @@ protected function setUp() {
parent::setUp();
// Assign user 1 a language code so that the entity can be translated.
$user = user_load(1);
$user = User::load(1);
$user->langcode = 'en';
$user->save();
// Assign user 2 LANGCODE_NOT_SPECIFIED code so entity can't be translated.
$user = user_load(2);
$user = User::load(2);
$user->langcode = Language::LANGCODE_NOT_SPECIFIED;
$user->save();
......
......@@ -53,6 +53,13 @@ class DbLogController extends ControllerBase {
*/
protected $formBuilder;
/**
* The user storage.
*
* @var \Drupal\user\UserStorageInterface
*/
protected $userStorage;
/**
* {@inheritdoc}
*/
......@@ -82,6 +89,7 @@ public function __construct(Connection $database, ModuleHandlerInterface $module
$this->moduleHandler = $module_handler;
$this->dateFormatter = $date_formatter;
$this->formBuilder = $form_builder;
$this->userStorage = $this->entityManager()->getStorage('user');
}
/**
......@@ -188,7 +196,7 @@ public function overview() {
}
$username = array(
'#theme' => 'username',
'#account' => user_load($dblog->uid),
'#account' => $this->userStorage->load($dblog->uid),
);
$rows[] = array(
'data' => array(
......@@ -239,7 +247,7 @@ public function eventDetails($event_id) {
$message = $this->formatMessage($dblog);
$username = array(
'#theme' => 'username',
'#account' => user_load($dblog->uid),
'#account' => $this->userStorage->load($dblog->uid),
);
$rows = array(
array(
......
......@@ -16,6 +16,7 @@
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\taxonomy\Entity\Vocabulary;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Drupal\user\Entity\User;
/**
* Implements hook_help().
......@@ -629,7 +630,7 @@ function template_preprocess_forum_icon(&$variables) {
function template_preprocess_forum_submitted(&$variables) {
$variables['author'] = '';
if (isset($variables['topic']->uid)) {
$username = array('#theme' => 'username', '#account' => user_load($variables['topic']->uid));
$username = array('#theme' => 'username', '#account' => User::load($variables['topic']->uid));
$variables['author'] = drupal_render($username);
}
$variables['time'] = isset($variables['topic']->created) ? \Drupal::service('date.formatter')->formatInterval(REQUEST_TIME - $variables['topic']->created) : '';
......
......@@ -7,6 +7,7 @@
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Language\LanguageInterface;
use Drupal\user\Entity\User;
/**
* Implements hook_token_info().
......@@ -174,7 +175,7 @@ function node_tokens($type, $tokens, array $data = array(), array $options = arr
// Default values for the chained tokens handled below.
case 'author':
$account = $node->getOwner() ? $node->getOwner() : user_load(0);
$account = $node->getOwner() ? $node->getOwner() : User::load(0);
$replacements[$original] = $sanitize ? SafeMarkup::checkPlain($account->label()) : $account->label();
break;
......
......@@ -10,6 +10,7 @@
use Drupal\Core\Language\LanguageInterface;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\node\Entity\NodeType;
use Drupal\user\Entity\User;
/**
* Tests node access functionality with multiple languages and two node access
......@@ -86,7 +87,7 @@ protected function setUp() {
// Load the user 1 user for later use as an admin user with permission to
// see everything.
$this->adminUser = user_load(1);
$this->adminUser = User::load(1);
// The node_access_test_language module allows individual translations of a
// node to be marked private (not viewable by normal users), and the
......
......@@ -9,6 +9,7 @@
use Drupal\Core\Language\LanguageInterface;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\user\Entity\User;
/**
* Tests node_access and db_select() with node_access tag functionality with
......@@ -79,7 +80,7 @@ protected function setUp() {
// Load the user 1 user for later use as an admin user with permission to
// see everything.
$this->adminUser = user_load(1);
$this->adminUser = User::load(1);
// Add Hungarian and Catalan.
ConfigurableLanguage::createFromLangcode('hu')->save();
......
......@@ -10,6 +10,7 @@
use Drupal\Core\Language\LanguageInterface;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\node\Entity\NodeType;
use Drupal\user\Entity\User;
/**
* Tests node_access and db_select() with node_access tag functionality with
......@@ -226,7 +227,7 @@ function testNodeAccessQueryTag() {
// Load the user 1 user for later use as an admin user with permission to
// see everything.
$admin_user = user_load(1);
$admin_user = User::load(1);
// Creating a private node with langcode Hungarian, will be saved as
// the fallback in node access table.
......
......@@ -8,7 +8,6 @@
namespace Drupal\rest\Tests;
use Drupal\Core\Url;
use Drupal\rest\Tests\RESTTestBase;
/**
* Tests the deletion of resources.
......@@ -72,7 +71,9 @@ public function testDelete() {
$account = $this->drupalCreateUser();
$this->drupalLogin($account);
$this->httpRequest($account->urlInfo(), 'DELETE');
$user = entity_load('user', $account->id(), TRUE);
$user_storage = $this->container->get('entity.manager')->getStorage('user');
$user_storage->resetCache(array($account->id()));
$user = $user_storage->load($account->id());
$this->assertEqual($account->id(), $user->id(), 'User still exists in the database.');
$this->assertResponse(405);
}
......
......@@ -678,7 +678,7 @@ protected function checkPermissions(array $permissions) {
* $this->drupalLogin($account);
* // Load real user object.
* $pass_raw = $account->passRaw;
* $account = user_load($account->id());
* $account = User::load($account->id());
* $account->passRaw = $pass_raw;
* @endcode
*
......
......@@ -672,7 +672,7 @@ protected function checkPermissions(array $permissions) {
* $this->drupalLogin($account);
* // Load real user object.
* $pass_raw = $account->pass_raw;
* $account = user_load($account->id());
* $account = User::load($account->id());
* $account->pass_raw = $pass_raw;
* @endcode
*
......
......@@ -16,6 +16,7 @@
use Drupal\taxonomy\Entity\Term;
use Drupal\node\Entity\Node;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\user\Entity\User;
/**
* Tests the invocation of hooks when creating, inserting, loading, updating or
......@@ -504,7 +505,7 @@ public function testUserHooks() {
));
$GLOBALS['entity_crud_hook_test'] = array();
user_load($account->id());
User::load($account->id());
$this->assertHookMessageOrder(array(
'entity_crud_hook_test_entity_load called for type user',
......
......@@ -12,6 +12,7 @@
use Drupal\Core\Language\LanguageInterface;
use Drupal\comment\CommentInterface;
use Drupal\simpletest\WebTestBase;
use Drupal\user\Entity\User;
/**
* Tests for the base handlers provided by Entity Reference.
......@@ -209,8 +210,8 @@ public function testUserHandler() {
// Build a set of test data.
$user_values = array(
'anonymous' => user_load(0),
'admin' => user_load(1),
'anonymous' => User::load(0),
'admin' => User::load(1),
'non_admin' => array(
'name' => 'non_admin <&>',
'mail' => 'non_admin@example.com',
......
......@@ -10,6 +10,7 @@
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\user\Entity\User;
/**
* Form controller for database_test module.
......@@ -53,7 +54,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$options = array();
foreach (user_load_multiple($uids) as $account) {
foreach (User::loadMultiple($uids) as $account) {
$options[$account->id()] = array(
'title' => array('data' => array('#title' => SafeMarkup::checkPlain($account->getUsername()))),
'username' => SafeMarkup::checkPlain($account->getUsername()),
......
......@@ -10,6 +10,7 @@
use Drupal\Core\PathProcessor\InboundPathProcessorInterface;
use Drupal\Core\PathProcessor\OutboundPathProcessorInterface;
use Symfony\Component\HttpFoundation\Request;
use Drupal\user\Entity\User;
/**
* Path processor for url_alter_test.
......@@ -45,7 +46,7 @@ public function processInbound($path, Request $request) {
public function processOutbound($path, &$options = array(), Request $request = NULL) {
// Rewrite user/uid to user/username.
if (preg_match('!^user/([0-9]+)(/.*)?!', $path, $matches)) {
if ($account = user_load($matches[1])) {
if ($account = User::load($matches[1])) {
$matches += array(2 => '');
$path = 'user/' . $account->getUsername() . $matches[2];
}
......
......@@ -6,6 +6,7 @@
*/
use Drupal\Component\Utility\SafeMarkup;
use Drupal\user\Entity\User;
/**
* @addtogroup hooks
......@@ -84,7 +85,7 @@ function hook_tokens($type, $tokens, array $data = array(), array $options = arr
// Default values for the chained tokens handled below.
case 'author':
$account = $node->getOwner() ? $node->getOwner() : user_load(0);
$account = $node->getOwner() ? $node->getOwner() : User::load(0);
$replacements[$original] = $sanitize ? SafeMarkup::checkPlain($account->label()) : $account->label();
break;
......
......@@ -37,6 +37,13 @@ class UserSelection extends SelectionBase {
*/
protected $connection;
/**
* The user storage.
*
* @var \Drupal\user\UserStorageInterface
*/
protected $userStorage;
/**
* Constructs a new UserSelection object.
*
......@@ -59,6 +66,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_manager, $module_handler, $current_user);
$this->connection = $connection;
$this->userStorage = $entity_manager->getStorage('user');
}
/**
......@@ -194,7 +202,7 @@ public function entityQueryAlter(SelectInterface $query) {
$value_part->condition('anonymous_name', $condition['value'], $condition['operator']);
$value_part->compile($this->connection, $query);
$or->condition(db_and()
->where(str_replace('anonymous_name', ':anonymous_name', (string) $value_part), $value_part->arguments() + array(':anonymous_name' => user_format_name(user_load(0))))
->where(str_replace('anonymous_name', ':anonymous_name', (string) $value_part), $value_part->arguments() + array(':anonymous_name' => user_format_name($this->userStorage->load(0))))
->condition('base_table.uid', 0)
);
$query->condition($or);
......
......@@ -8,6 +8,7 @@
namespace Drupal\user\Tests;
use Drupal\simpletest\WebTestBase;
use Drupal\user\Entity\User;
/**
* Tests the user admin listing if views is not enabled.
......@@ -57,7 +58,7 @@ public function testUserListing() {
$admin_user = $this->drupalCreateUser(array('administer users'));
$accounts[$admin_user->label()] = $admin_user;
$accounts['admin'] = entity_load('user', 1);
$accounts['admin'] = User::load(1);
$this->drupalLogin($admin_user);
......
......@@ -39,6 +39,8 @@ function testUserAdmin() {
$user_c->name = 'User C';
$user_c->save();
$user_storage = $this->container->get('entity.manager')->getStorage('user');
// Create admin user to delete registered user.
$admin_user = $this->drupalCreateUser(array('administer users'));
// Use a predictable name so that we can reliably order the user admin page
......@@ -94,7 +96,7 @@ function testUserAdmin() {
$this->assertText($user_c->getUsername(), 'User C on filtered by role on admin users page');
// Test blocking of a user.
$account = user_load($user_c->id());
$account = $user_storage->load($user_c->id());
$this->assertTrue($account->isActive(), 'User C not blocked');
$edit = array();
$edit['action'] = 'user_block_user_action';
......@@ -104,7 +106,8 @@ function testUserAdmin() {
// targeted with the blocking action.
'query' => array('order' => 'name', 'sort' => 'asc')
));
$account = user_load($user_c->id(), TRUE);
$user_storage->resetCache(array($user_c->id()));
$account = $user_storage->load($user_c->id());
$this->assertTrue($account->isBlocked(), 'User C blocked');
// Test filtering on admin page for blocked users
......@@ -122,18 +125,22 @@ function testUserAdmin() {
// targeted with the blocking action.
'query' => array('order' => 'name', 'sort' => 'asc')
));
$account = user_load($user_c->id(), TRUE);
$user_storage->resetCache(array($user_c->id()));
$account = $user_storage->load($user_c->id());
$this->assertTrue($account->isActive(), 'User C unblocked');
$this->assertMail("to", $account->getEmail(), "Activation mail sent to user C");
// Test blocking and unblocking another user from /user/[uid]/edit form and sending of activation mail
$user_d = $this->drupalCreateUser(array());
$account1 = user_load($user_d->id(), TRUE);
$user_storage->resetCache(array($user_d->id()));
$account1 = $user_storage->load($user_d->id());
$this->drupalPostForm('user/' . $account1->id() . '/edit', array('status' => 0), t('Save'));
$account1 = user_load($user_d->id(), TRUE);
$user_storage->resetCache(array($user_d->id()));
$account1 = $user_storage->load($user_d->id());
$this->assertTrue($account1->isBlocked(), 'User D blocked');
$this->drupalPostForm('user/' . $account1->id() . '/edit', array('status' => TRUE), t('Save'));
$account1 = user_load($user_d->id(), TRUE);
$user_storage->resetCache(array($user_d->id()));
$account1 = $user_storage->load($user_d->id());
$this->assertTrue($account1->isActive(), 'User D unblocked');
$this->assertMail("to", $account1->getEmail(), "Activation mail sent to user D");
}
......
......@@ -8,6 +8,7 @@
namespace Drupal\user\Tests;
use Drupal\simpletest\WebTestBase;
use Drupal\user\Entity\User;
/**
* Tests account deleting of users.
......@@ -38,7 +39,7 @@ function testUserDeleteMultiple() {
$this->assertTrue($roles_created > 0, 'Role assignments created for new users and deletion of role assignments can be tested');
// We should be able to load one of the users.
$this->assertTrue(user_load($user_a->id()), 'User is created and deletion of user can be tested');
$this->assertTrue(User::load($user_a->id()), 'User is created and deltion of user can be tested');
// Delete the users.
user_delete_multiple($uids);
// Test if the roles assignments are deleted.
......@@ -50,9 +51,9 @@ function testUserDeleteMultiple() {
->execute()
->fetchField();
$this->assertTrue($roles_after_deletion == 0, 'Role assignments deleted along with users');
// Test if the users are deleted, user_load() will return FALSE.
$this->assertFalse(user_load($user_a->id()), format_string('User with id @uid deleted.', array('@uid' => $user_a->id())));
$this->assertFalse(user_load($user_b->id()), format_string('User with id @uid deleted.', array('@uid' => $user_b->id())));
$this->assertFalse(user_load($user_c->id()), format_string('User with id @uid deleted.', array('@uid' => $user_c->id())));
// Test if the users are deleted, User::load() will return NULL.
$this->assertNull(User::load($user_a->id()), format_string('User with id @uid deleted.', array('@uid' => $user_a->id())));
$this->assertNull(User::load($user_b->id()), format_string('User with id @uid deleted.', array('@uid' => $user_b->id())));
$this->assertNull(User::load($user_c->id()), format_string('User with id @uid deleted.', array('@uid' => $user_c->id())));
}
}
......@@ -9,6 +9,7 @@
use Drupal\simpletest\WebTestBase;
use Drupal\Core\Password\PhpassHashedPassword;
use Drupal\user\Entity\User;
/**
* Ensure that login works as expected.
......@@ -126,7 +127,8 @@ function testPasswordRehashOnLogin() {
$this->drupalLogin($account);
$this->drupalLogout();
// Load the stored user. The password hash should reflect $default_count_log2.
$account = user_load($account->id());
$user_storage = $this->container->get('entity.manager')->getStorage('user');
$account = User::load($account->id());
$this->assertIdentical($password_hasher->getCountLog2($account->getPassword()), $default_count_log2);
// Change the required number of iterations by loading a test-module
......@@ -139,7 +141,8 @@ function testPasswordRehashOnLogin() {
$account->pass_raw = $password;
$this->drupalLogin($account);
// Load the stored user, which should have a different password hash now.
$account = user_load($account->id(), TRUE);
$user_storage->resetCache(array($account->id()));
$account = $user_storage->load($account->id());
$this->assertIdentical($password_hasher->getCountLog2($account->getPassword()), $overridden_count_log2);
}
......
......@@ -56,7 +56,7 @@ protected function setUp() {
// Activate user by logging in.
$this->drupalLogin($account);
$this->account = user_load($account->id());
$this->account = User::load($account->id());
$this->drupalLogout();
// Set the last login time that is used to generate the one-time link so
......
......@@ -7,7 +7,6 @@
namespace Drupal\user\Tests;
use Drupal\Core\Cache\Cache;
use Drupal\simpletest\WebTestBase;
/**
......@@ -131,7 +130,9 @@ function saveUserPicture($image) {
$this->drupalPostForm('user/' . $this->webUser->id() . '/edit', $edit, t('Save'));
// Load actual user data from database.
$account = user_load($this->webUser->id(), TRUE);
$user_storage = $this->container->get('entity.manager')->getStorage('user');
$user_storage->resetCache(array($this->webUser->id()));
$account = $user_storage->load($this->webUser->id());
return file_load($account->user_picture->target_id, TRUE);
}
}
......@@ -85,7 +85,9 @@ function testCreateUserWithRole() {
* Defaults to TRUE.
*/
private function userLoadAndCheckRoleAssigned($account, $rid, $is_assigned = TRUE) {
$account = user_load($account->id(), TRUE);
$user_storage = $this->container->get('entity.manager')->getStorage('user');
$user_storage->resetCache(array($account->id()));
$account = $user_storage->load($account->id());
if ($is_assigned) {
$this->assertFalse(array_search($rid, $account->getRoles()) === FALSE, 'The role is present in the user object.');
}
......
......@@ -8,6 +8,7 @@
namespace Drupal\user\Tests;
use Drupal\simpletest\WebTestBase;
use Drupal\user\Entity\User;
/**
* Tests account saving for arbitrary new uid.
......@@ -42,7 +43,7 @@ function testUserImport() {
$user->save();
// Test if created user exists.
$user_by_uid = user_load($test_uid);
$user_by_uid = User::load($test_uid);
$this->assertTrue($user_by_uid, 'Loading user by uid.');
$user_by_name = user_load_by_name($test_name);
......
......@@ -10,6 +10,7 @@
use Drupal\Component\Utility\SafeMarkup;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\simpletest\WebTestBase;
use Drupal\user\Entity\User;
/**
* Generates text using placeholders for dummy content to check user token
......@@ -49,8 +50,8 @@ function testUserTokenReplacement() {
$this->drupalLogout();
$this->drupalLogin($user2);
$account = user_load($user1->id());
$global_account = user_load(\Drupal::currentUser()->id());
$account = User::load($user1->id());
$global_account = User::load(\Drupal::currentUser()->id());
// Generate and test sanitized tokens.
$tests = array();
......
......@@ -38,6 +38,7 @@ class BulkFormTest extends UserTestBase {
public function testBulkForm() {
// Login as a user without 'administer users'.
$this->drupalLogin($this->drupalCreateUser(array('administer permissions')));
$user_storage = $this->container->get('entity.manager')->getStorage('user');
// Create an user which actually can change users.
$this->drupalLogin($this->drupalCreateUser(array('administer users')));
......@@ -53,7 +54,7 @@ public function testBulkForm() {
$this->assertText(t('No users selected.'));
// Assign a role to a user.
$account = entity_load('user', $this->users[0]->id());
$account = $user_storage->load($this->users[0]->id());
$roles = user_role_names(TRUE);
unset($roles[RoleInterface::AUTHENTICATED_ID]);
$role = key($roles);
......@@ -65,7 +66,8 @@ public function testBulkForm() {
);
$this->drupalPostForm(NULL, $edit, t('Apply'));
// Re-load the user and check their roles.
$account = entity_load('user', $account->id(), TRUE);
$user_storage->resetCache(array($account->id()));
$account = $user_storage->load($account->id());
$this->assertTrue($account->hasRole($role), 'The user now has the custom role.');
$edit = array(
......@@ -74,7 +76,8 @@ public function testBulkForm() {
);
$this->drupalPostForm(NULL, $edit, t('Apply'));
// Re-load the user and check their roles.
$account = entity_load('user', $account->id(), TRUE);
$user_storage->resetCache(array($account->id()));
$account = $user_storage->load($account->id());
$this->assertFalse($account->hasRole($role), 'The user no longer has the custom role.');
// Block a user using the bulk form.
......@@ -86,7 +89,8 @@ public function testBulkForm() {
);
$this->drupalPostForm(NULL, $edit, t('Apply'));
// Re-load the user and check their status.
$account = entity_load('user', $account->id(), TRUE);
$user_storage->resetCache(array($account->id()));
$account = $user_storage->load($account->id());
$this->assertTrue($account->isBlocked(), 'The user is blocked.');
$this->assertNoRaw($account->label(), 'The user is not found in the table.');
......@@ -105,7 +109,7 @@ public function testBulkForm() {
'action' => 'user_block_user_action',
);
$this->drupalPostForm(NULL, $edit, t('Apply'));
$anonymous_account = user_load(0);
$anonymous_account = $user_storage->load(0);
$this->assertTrue($anonymous_account->isBlocked(), 'Ensure the anonymous user got blocked.');
// Test the list of available actions with a value that contains a dot.
......
......@@ -8,6 +8,7 @@
namespace Drupal\user\Tests\Views;
use Drupal\views\Views;
use Drupal\user\Entity\User;
/**
* Tests the handler of the user: role field.
......@@ -36,7 +37,7 @@ public function testRole() {
$this->drupalCreateRole(array('access content'), $rolename_not_assigned, $rolename_not_assigned);
// Add roles to user 1.
$user = entity_load('user', 1);
$user = User::load(1);
$user->addRole($rolename_a);
$user->addRole($rolename_b);
$user->save();
......
......@@ -9,6 +9,7 @@
use Drupal\views\Tests\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
use Drupal\user\Entity\User;
/**
* @todo.
......@@ -42,7 +43,7 @@ protected function setUp() {
ViewTestData::createTestViews(get_class($this), array('user_test_views'));
$this->users[] = $this->drupalCreateUser();
$this->users[] = user_load(1);
$this->users[] = User::load(1);
$this->nodes[] = $this->drupalCreateNode(array('uid' => $this->users[0]->id()));
$this->nodes[] = $this->drupalCreateNode(array('uid' => 1));
}
......
......@@ -177,7 +177,7 @@ function user_entity_extra_field_info() {
* An array of user objects, indexed by uid.
*
* @see entity_load_multiple()
* @see user_load()
* @see \Drupal\user\Entity\User::load()
* @see user_load_by_mail()
* @see user_load_by_name()
* @see \Drupal\Core\Entity\Query\QueryInterface
......@@ -208,7 +208,7 @@ function user_load_multiple(array $uids = NULL, $reset = FALSE) {
* @deprecated in Drupal 8.x, will be removed before Drupal 9.0.
* Use \Drupal\user\Entity\User::load().
*
* @see user_load_multiple()
* @see \Drupal\user\Entity\User::loadMultiple()
*/
function user_load($uid, $reset = FALSE) {
if ($reset) {
......@@ -226,7 +226,7 @@ function user_load($uid, $reset = FALSE) {
* A fully-loaded $user object upon successful user load or FALSE if user
* cannot be loaded.
*
* @see user_load_multiple()
* @see \Drupal\user\Entity\User::loadMultiple()
*/
function user_load_by_mail($mail) {
$users = entity_load_multiple_by_properties('user', array('mail' => $mail));
......@@ -242,7 +242,7 @@ function user_load_by_mail($mail) {
* A fully-loaded $user object upon successful user load or FALSE if user
* cannot be loaded.
*
* @see user_load_multiple()
* @see \Drupal\user\Entity\User::loadMultiple()
*/
function user_load_by_name($name) {
$users = entity_load_multiple_by_properties('user', array('name' => $name));
......@@ -660,7 +660,7 @@ function user_pass_rehash($password, $timestamp, $login, $uid) {
* @see _user_cancel()
*/
function user_cancel($edit, $uid, $method) {
$account = user_load($uid);
$account = User::load($uid);
if (!$account) {
drupal_set_message(t('The user account %id does not exist.', array('%id' => $uid)), 'error');
......@@ -877,7 +877,7 @@ function user_view($account, $view_mode = 'full', $langcode = NULL) {
* Constructs a drupal_render() style array from an array of loaded users.
*
* @param $accounts
* An array of user accounts as returned by user_load_multiple().
* An array of user accounts as returned by User::loadMultiple().
* @param $view_mode
* (optional) View mode, e.g., 'full', 'teaser'... Defaults to 'teaser.'
* @param $langcode
......