diff --git a/core/modules/user/src/Tests/UserRegistrationTest.php b/core/modules/user/src/Tests/UserRegistrationTest.php index 853891a..4bda214 100644 --- a/core/modules/user/src/Tests/UserRegistrationTest.php +++ b/core/modules/user/src/Tests/UserRegistrationTest.php @@ -44,6 +44,9 @@ function testRegistrationWithEmailVerification() { $accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail)); $new_user = reset($accounts); $this->assertTrue($new_user->isActive(), 'New account is active after registration.'); + $resetURL = $this->getResetURL(); + $this->drupalGet($resetURL); + $this->assertTitle(t('Set Password | Drupal'), 'Page title is "Set Password".'); // Allow registration by site visitors, but require administrator approval. $config->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save(); @@ -278,4 +281,16 @@ function testRegistrationWithUserFields() { } } + /** + * Retrieves password set email and extracts the login link. + */ + 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]; + } }