- // Update uid 1's name and password to we know it.
- $password = user_password();
- $account = [
- 'name' => 'user1',
- 'pass' => $this->container->get('password')->hash(trim($password)),
- ];
- // We cannot use $account->save() here, because this would result in the
- // password being hashed again.
- db_update('users_field_data')
- ->fields($account)
- ->condition('uid', 1)
- ->execute();
-
- // Reload and log in uid 1.
- $user_storage->resetCache([1]);
- $user1 = $user_storage->load(1);
- $user1->pass_raw = $password;