function UserPasswordResetTestCase::getResetURL

Retrieves password reset email and extracts the login link.

2 calls to UserPasswordResetTestCase::getResetURL()
UserPasswordResetTestCase::testPasswordResetFloodControlPerUser in modules/user/user.test
Test user-based flood control on password reset.
UserPasswordResetTestCase::testUserPasswordReset in modules/user/user.test
Tests password reset functionality.

File

modules/user/user.test, line 540

Class

UserPasswordResetTestCase
Tests resetting a user password.

Code

public function getResetURL($bypass_form = FALSE) {
  // Assume the most recent email.
  $_emails = $this->drupalGetMails();
  $email = end($_emails);
  $urls = array();
  preg_match('#.+user/reset/.+#', $email['body'], $urls);
  return $urls[0] . ($bypass_form ? '/login' : '');
}

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