You are here

protected function UpdatePathTestBase::replaceUser1 in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Update/UpdatePathTestBase.php \Drupal\system\Tests\Update\UpdatePathTestBase::replaceUser1()

Replace User 1 with the user created here.

1 call to UpdatePathTestBase::replaceUser1()
UpdatePathTestBase::setUp in core/modules/system/src/Tests/Update/UpdatePathTestBase.php
Overrides WebTestBase::setUp() for update testing.
2 methods override UpdatePathTestBase::replaceUser1()
UpdatePathRC1TestBaseFilledTest::replaceUser1 in core/modules/system/src/Tests/Update/UpdatePathRC1TestBaseFilledTest.php
Replace User 1 with the user created here.
UpdatePathTestBaseFilledTest::replaceUser1 in core/modules/system/src/Tests/Update/UpdatePathTestBaseFilledTest.php
Replace User 1 with the user created here.

File

core/modules/system/src/Tests/Update/UpdatePathTestBase.php, line 303
Contains \Drupal\system\Tests\Update\UpdatePathTestBase.

Class

UpdatePathTestBase
Provides a base class for writing an update test.

Namespace

Drupal\system\Tests\Update

Code

protected function replaceUser1() {

  /** @var \Drupal\user\UserInterface $account */

  // @todo: Saving the account before the update is problematic.
  //   https://www.drupal.org/node/2560237
  $account = User::load(1);
  $account
    ->setPassword($this->rootUser->pass_raw);
  $account
    ->setEmail($this->rootUser
    ->getEmail());
  $account
    ->setUsername($this->rootUser
    ->getUsername());
  $account
    ->save();
}