protected function UserPasswordResetTest::setUp in Drupal 10
Same name in this branch
- 10 core/modules/user/tests/src/Functional/UserPasswordResetTest.php \Drupal\Tests\user\Functional\UserPasswordResetTest::setUp()
- 10 core/modules/user/tests/src/FunctionalJavascript/UserPasswordResetTest.php \Drupal\Tests\user\FunctionalJavascript\UserPasswordResetTest::setUp()
Same name and namespace in other branches
- 8 core/modules/user/tests/src/FunctionalJavascript/UserPasswordResetTest.php \Drupal\Tests\user\FunctionalJavascript\UserPasswordResetTest::setUp()
- 9 core/modules/user/tests/src/FunctionalJavascript/UserPasswordResetTest.php \Drupal\Tests\user\FunctionalJavascript\UserPasswordResetTest::setUp()
File
- core/
modules/ user/ tests/ src/ FunctionalJavascript/ UserPasswordResetTest.php, line 53
Class
- UserPasswordResetTest
- Ensure that password reset methods work as expected.
Namespace
Drupal\Tests\user\FunctionalJavascriptCode
protected function setUp() : void {
parent::setUp();
// Create a user.
$account = $this
->drupalCreateUser();
// Activate user by logging in.
$this
->drupalLogin($account);
$this->account = User::load($account
->id());
$this->account->pass_raw = $account->pass_raw;
$this
->drupalLogout();
// Set the last login time that is used to generate the one-time link so
// that it is definitely over a second ago.
$account->login = REQUEST_TIME - mt_rand(10, 100000);
Database::getConnection()
->update('users_field_data')
->fields([
'login' => $account
->getLastLoginTime(),
])
->condition('uid', $account
->id())
->execute();
}