1 user_password_reset.test public UserPasswordResetTest::testUserPasswordResetAlreadyLoggedIn()

Test user password reset in a browser where the same user is already logged in.

File

core/modules/user/tests/user_password_reset.test, line 390
Tests for resetting the password.

Class

UserPasswordResetTest

Code

public function testUserPasswordResetAlreadyLoggedIn() {
  $account = $this->backdropCreateUser();
  $this->backdropLogin($account);
  // Make sure the test account has a valid password.
  $account->pass = user_password();
  $account->save();

  // Generate one time login link.
  $reset_url = user_pass_reset_url($account);
  $this->backdropGet($reset_url);

  $this->assertText('Reset password');
  $pass = user_password();
  $edit = array(
    'pass[pass1]' => $pass,
    'pass[pass2]' => $pass,
  );
  $this->backdropPost(NULL, $edit, t('Save password & log in'));

  $this->assertText('Your account password has been updated.');
}