Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / user / src / Tests / UserResetEmailTestTrait.php
1 <?php
2
3 namespace Drupal\user\Tests;
4
5 use Drupal\Core\Test\AssertMailTrait;
6
7 /**
8  * Helper function for logging in from reset password email.
9  */
10 trait UserResetEmailTestTrait {
11
12   use AssertMailTrait {
13     getMails as drupalGetMails;
14   }
15
16   /**
17    * Login from reset password email.
18    */
19   protected function loginFromResetEmail() {
20     $_emails = $this->drupalGetMails();
21     $email = end($_emails);
22     $urls = [];
23     preg_match('#.+user/reset/.+#', $email['body'], $urls);
24     $resetURL = $urls[0];
25     $this->drupalGet($resetURL);
26     $this->drupalPostForm(NULL, NULL, 'Log in');
27   }
28
29 }