protected function UserResetEmailTestTrait::loginFromResetEmail in Drupal 8
Login from reset password email.
File
- core/
modules/ user/ src/ Tests/ UserResetEmailTestTrait.php, line 26
Class
- UserResetEmailTestTrait
- Helper function for logging in from reset password email.
Namespace
Drupal\user\TestsCode
protected function loginFromResetEmail() {
$_emails = $this
->drupalGetMails();
$email = end($_emails);
$urls = [];
preg_match('#.+user/reset/.+#', $email['body'], $urls);
$resetURL = $urls[0];
$this
->drupalGet($resetURL);
$this
->drupalPostForm(NULL, NULL, 'Log in');
}