function UserLoginHttpTest::loginFromResetEmail

Login from reset password email.

1 call to UserLoginHttpTest::loginFromResetEmail()
UserLoginHttpTest::doTestPasswordReset in core/modules/user/tests/src/Functional/UserLoginHttpTest.php
Do password reset testing for given format and account.

File

core/modules/user/tests/src/Functional/UserLoginHttpTest.php, line 602

Class

UserLoginHttpTest
Tests login and password reset via direct HTTP.

Namespace

Drupal\Tests\user\Functional

Code

protected function loginFromResetEmail() : void {
  $_emails = $this->drupalGetMails();
  $email = end($_emails);
  $urls = [];
  preg_match('#.+user/reset/.+#', $email['body'], $urls);
  $resetURL = $urls[0];
  $this->drupalGet($resetURL);
  $this->submitForm([], 'Log in');
  $this->assertSession()
    ->pageTextContains('You have used a one-time login link. You can set your new password now.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.