comparison core/modules/user/src/Tests/UserResetEmailTestTrait.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 129ea1e6d783
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
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 }