trait UserResetEmailTestTrait
Helper function for logging in from reset password email.
Hierarchy
- trait \Drupal\user\Tests\UserResetEmailTestTrait uses \Drupal\Core\Test\AssertMailTrait
Deprecated
in drupal:8.?.? and is removed from drupal:9.0.0. Add the method to the test class instead.
See also
https://www.drupal.org/node/2999766
File
-
core/
modules/ user/ src/ Tests/ UserResetEmailTestTrait.php, line 17
Namespace
Drupal\user\TestsView source
trait UserResetEmailTestTrait {
use AssertMailTrait {
getMails as drupalGetMails;
}
/**
* Login from reset password email.
*/
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');
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Member alias |
---|---|---|---|---|
AssertMailTrait::assertMail | protected | function | Asserts that the most recently sent email message has the given value. | |
AssertMailTrait::assertMailPattern | protected | function | Asserts that the most recently sent email message has the pattern in it. | |
AssertMailTrait::assertMailString | protected | function | Asserts that the most recently sent email message has the string in it. | |
AssertMailTrait::getMails | protected | function | Gets an array containing all emails sent during this test case. | Aliased as: drupalGetMails |
AssertMailTrait::verboseEmail | protected | function | Outputs to verbose the most recent $count emails sent. | |
UserResetEmailTestTrait::loginFromResetEmail | protected | function | Login from reset password email. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.