function UserPasswordResetTest::getResetURL

Same name in this branch
  1. 11.x core/modules/user/tests/src/FunctionalJavascript/UserPasswordResetTest.php \Drupal\Tests\user\FunctionalJavascript\UserPasswordResetTest::getResetURL()
Same name and namespace in other branches
  1. 9 core/modules/user/tests/src/FunctionalJavascript/UserPasswordResetTest.php \Drupal\Tests\user\FunctionalJavascript\UserPasswordResetTest::getResetURL()
  2. 9 core/modules/user/tests/src/Functional/UserPasswordResetTest.php \Drupal\Tests\user\Functional\UserPasswordResetTest::getResetURL()
  3. 8.9.x core/modules/user/tests/src/FunctionalJavascript/UserPasswordResetTest.php \Drupal\Tests\user\FunctionalJavascript\UserPasswordResetTest::getResetURL()
  4. 8.9.x core/modules/user/tests/src/Functional/UserPasswordResetTest.php \Drupal\Tests\user\Functional\UserPasswordResetTest::getResetURL()
  5. 10 core/modules/user/tests/src/FunctionalJavascript/UserPasswordResetTest.php \Drupal\Tests\user\FunctionalJavascript\UserPasswordResetTest::getResetURL()
  6. 10 core/modules/user/tests/src/Functional/UserPasswordResetTest.php \Drupal\Tests\user\Functional\UserPasswordResetTest::getResetURL()

Retrieves password reset email and extracts the login link.

4 calls to UserPasswordResetTest::getResetURL()
UserPasswordResetTest::testUserPasswordReset in core/modules/user/tests/src/Functional/UserPasswordResetTest.php
Tests password reset functionality.
UserPasswordResetTest::testUserPasswordResetLoggedIn in core/modules/user/tests/src/Functional/UserPasswordResetTest.php
Tests user password reset while logged in.
UserPasswordResetTest::testUserPasswordResetPreferredLanguage in core/modules/user/tests/src/Functional/UserPasswordResetTest.php
Tests password reset functionality when user has set preferred language.
UserPasswordResetTest::testUserResetPasswordUserFloodControlIsCleared in core/modules/user/tests/src/Functional/UserPasswordResetTest.php
Tests user password reset flood control is cleared on successful reset.

File

core/modules/user/tests/src/Functional/UserPasswordResetTest.php, line 316

Class

UserPasswordResetTest
Ensure that password reset methods work as expected.

Namespace

Drupal\Tests\user\Functional

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];
}

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