protected function ThunderTestTrait::replaceUser1 in Thunder 6.0.x
Same name and namespace in other branches
- 8.5 tests/src/Traits/ThunderTestTrait.php \Drupal\Tests\thunder\Traits\ThunderTestTrait::replaceUser1()
- 8.4 tests/src/Traits/ThunderTestTrait.php \Drupal\Tests\thunder\Traits\ThunderTestTrait::replaceUser1()
- 6.2.x tests/src/Traits/ThunderTestTrait.php \Drupal\Tests\thunder\Traits\ThunderTestTrait::replaceUser1()
- 6.1.x tests/src/Traits/ThunderTestTrait.php \Drupal\Tests\thunder\Traits\ThunderTestTrait::replaceUser1()
Replace User 1 with the user created here.
1 call to ThunderTestTrait::replaceUser1()
- ThunderTestTrait::installDrupal in tests/
src/ Traits/ ThunderTestTrait.php
File
- tests/
src/ Traits/ ThunderTestTrait.php, line 58
Class
- ThunderTestTrait
- Use this trait to reuse an existing database.
Namespace
Drupal\Tests\thunder\TraitsCode
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
->getAccountName());
$account
->save();
}