protected function UserPasswordResetTest::setUp in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/user/src/Tests/UserPasswordResetTest.php \Drupal\user\Tests\UserPasswordResetTest::setUp()
Sets up a Drupal site for running functional and integration tests.
Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.
Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.
After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.
Overrides PageCacheTagsTestBase::setUp
File
- core/
modules/ user/ src/ Tests/ UserPasswordResetTest.php, line 48 - Contains \Drupal\user\Tests\UserPasswordResetTest.
Class
- UserPasswordResetTest
- Ensure that password reset methods work as expected.
Namespace
Drupal\user\TestsCode
protected function setUp() {
parent::setUp();
$this
->drupalPlaceBlock('system_menu_block:account');
// 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);
db_update('users_field_data')
->fields(array(
'login' => $account
->getLastLoginTime(),
))
->condition('uid', $account
->id())
->execute();
}