public function UserPasswordResetTest::testUserPasswordResetLoggedIn in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/user/src/Tests/UserPasswordResetTest.php \Drupal\user\Tests\UserPasswordResetTest::testUserPasswordResetLoggedIn()
Test user password reset while logged in.
File
- core/
modules/ user/ src/ Tests/ UserPasswordResetTest.php, line 193 - Contains \Drupal\user\Tests\UserPasswordResetTest.
Class
- UserPasswordResetTest
- Ensure that password reset methods work as expected.
Namespace
Drupal\user\TestsCode
public function testUserPasswordResetLoggedIn() {
// Log in.
$this
->drupalLogin($this->account);
// Reset the password by username via the password reset page.
$this
->drupalGet('user/password');
$this
->drupalPostForm(NULL, NULL, t('Submit'));
// Click the reset URL while logged and change our password.
$resetURL = $this
->getResetURL();
$this
->drupalGet($resetURL);
$this
->drupalPostForm(NULL, NULL, t('Log in'));
// Change the password.
$password = user_password();
$edit = array(
'pass[pass1]' => $password,
'pass[pass2]' => $password,
);
$this
->drupalPostForm(NULL, $edit, t('Save'));
$this
->assertText(t('The changes have been saved.'), 'Password changed.');
}