function UserPasswordResetTest::testUserPasswordReset

Tests password reset functionality.

File

drupal/core/modules/user/lib/Drupal/user/Tests/UserPasswordResetTest.php, line 28
Definition of Drupal\user\Tests\UserPasswordResetTest.

Class

UserPasswordResetTest
Tests resetting a user password.

Namespace

Drupal\user\Tests

Code

function testUserPasswordReset() {

  // Create a user.
  $account = $this
    ->drupalCreateUser();
  $this
    ->drupalLogin($account);
  $this
    ->drupalLogout();

  // Attempt to reset password.
  $edit = array(
    'name' => $account->name,
  );
  $this
    ->drupalPost('user/password', $edit, t('E-mail new password'));

  // Confirm the password reset.
  $this
    ->assertText(t('Further instructions have been sent to your e-mail address.'), 'Password reset instructions mailed message displayed.');
}