You are here

protected function UserLoginHttpTest::loginFromResetEmail in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/user/tests/src/Functional/UserLoginHttpTest.php \Drupal\Tests\user\Functional\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 559

Class

UserLoginHttpTest
Tests login and password reset via direct HTTP.

Namespace

Drupal\Tests\user\Functional

Code

protected function loginFromResetEmail() {
  $_emails = $this
    ->drupalGetMails();
  $email = end($_emails);
  $urls = [];
  preg_match('#.+user/reset/.+#', $email['body'], $urls);
  $resetURL = $urls[0];
  $this
    ->drupalGet($resetURL);
  $this
    ->submitForm([], 'Log in');
}