You are here

public function UserPasswordResetTestCase::getResetURL in Drupal 7

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 498
Tests for user.module.

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' : '');
}