You are here

public function UserPasswordResetTest::getResetURL in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/src/Tests/UserPasswordResetTest.php \Drupal\user\Tests\UserPasswordResetTest::getResetURL()

Retrieves password reset email and extracts the login link.

2 calls to UserPasswordResetTest::getResetURL()
UserPasswordResetTest::testUserPasswordReset in core/modules/user/src/Tests/UserPasswordResetTest.php
Tests password reset functionality.
UserPasswordResetTest::testUserPasswordResetLoggedIn in core/modules/user/src/Tests/UserPasswordResetTest.php
Test user password reset while logged in.

File

core/modules/user/src/Tests/UserPasswordResetTest.php, line 180
Contains \Drupal\user\Tests\UserPasswordResetTest.

Class

UserPasswordResetTest
Ensure that password reset methods work as expected.

Namespace

Drupal\user\Tests

Code

public function getResetURL() {

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