function RestLoginHttpTest::loginFromResetEmail

Same name and namespace in other branches
  1. main core/modules/rest/tests/src/Functional/RestLoginHttpTest.php \Drupal\Tests\rest\Functional\RestLoginHttpTest::loginFromResetEmail()

Login from reset password email.

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

File

core/modules/rest/tests/src/Functional/RestLoginHttpTest.php, line 599

Class

RestLoginHttpTest
Tests login and password reset via direct HTTP.

Namespace

Drupal\Tests\rest\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.