You are here

public function UserPasswordResetTest::getResetURL in Drupal 10

Same name in this branch
  1. 10 core/modules/user/tests/src/Functional/UserPasswordResetTest.php \Drupal\Tests\user\Functional\UserPasswordResetTest::getResetURL()
  2. 10 core/modules/user/tests/src/FunctionalJavascript/UserPasswordResetTest.php \Drupal\Tests\user\FunctionalJavascript\UserPasswordResetTest::getResetURL()
Same name and namespace in other branches
  1. 8 core/modules/user/tests/src/FunctionalJavascript/UserPasswordResetTest.php \Drupal\Tests\user\FunctionalJavascript\UserPasswordResetTest::getResetURL()
  2. 9 core/modules/user/tests/src/FunctionalJavascript/UserPasswordResetTest.php \Drupal\Tests\user\FunctionalJavascript\UserPasswordResetTest::getResetURL()

Retrieves password reset email and extracts the login link.

File

core/modules/user/tests/src/FunctionalJavascript/UserPasswordResetTest.php, line 119

Class

UserPasswordResetTest
Ensure that password reset methods work as expected.

Namespace

Drupal\Tests\user\FunctionalJavascript

Code

public function getResetURL() {

  // Assume the most recent email.
  $_emails = $this
    ->drupalGetMails();
  $email = end($_emails);
  $urls = [];
  preg_match('#.+user/reset/.+#', $email['body'], $urls);
  return $urls[0];
}