function UpdatePathTestBase::replaceUser1
Same name in other branches
- 9 core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php \Drupal\FunctionalTests\Update\UpdatePathTestBase::replaceUser1()
- 8.9.x core/modules/system/src/Tests/Update/UpdatePathTestBase.php \Drupal\system\Tests\Update\UpdatePathTestBase::replaceUser1()
- 8.9.x core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php \Drupal\FunctionalTests\Update\UpdatePathTestBase::replaceUser1()
- 10 core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php \Drupal\FunctionalTests\Update\UpdatePathTestBase::replaceUser1()
Replace User 1 with the user created here.
1 call to UpdatePathTestBase::replaceUser1()
- UpdatePathTestBase::installDrupal in core/
tests/ Drupal/ FunctionalTests/ Update/ UpdatePathTestBase.php - Overrides BrowserTestBase::installDrupal() for update testing.
1 method overrides UpdatePathTestBase::replaceUser1()
- UpdatePathTestBaseFilledTest::replaceUser1 in core/
modules/ system/ tests/ src/ Functional/ UpdateSystem/ UpdatePathTestBaseFilledTest.php - Replace User 1 with the user created here.
File
-
core/
tests/ Drupal/ FunctionalTests/ Update/ UpdatePathTestBase.php, line 226
Class
- UpdatePathTestBase
- Provides a base class for writing an update test.
Namespace
Drupal\FunctionalTests\UpdateCode
protected function replaceUser1() {
// We try not to save content entities in hook_update_N() because the schema
// might be out of sync, or hook invocations might rely on other schemas
// that also aren't updated yet. Hence we are directly updating the database
// tables with the values.
Database::getConnection()->update('users_field_data')
->fields([
'name' => $this->rootUser
->getAccountName(),
'pass' => \Drupal::service('password')->hash($this->rootUser->pass_raw),
'mail' => $this->rootUser
->getEmail(),
])
->condition('uid', 1)
->execute();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.