public function UserPasswordResetTest::testUserResetPasswordTextboxFilled

Prefill the text box on incorrect login via link to password reset page.

File

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

Class

UserPasswordResetTest
Tests resetting a user password.

Namespace

Drupal\user\Tests

Code

public function testUserResetPasswordTextboxFilled() {
  $this
    ->drupalGet('user/login');
  $edit = array(
    'name' => $this
      ->randomName(),
    'pass' => $this
      ->randomName(),
  );
  $this
    ->drupalPost('user', $edit, t('Log in'));
  $this
    ->assertRaw(t('Sorry, unrecognized username or password. <a href="@password">Have you forgotten your password?</a>', array(
    '@password' => url('user/password', array(
      'query' => array(
        'name' => $edit['name'],
      ),
    )),
  )));
  unset($edit['pass']);
  $this
    ->drupalGet('user/password', array(
    'query' => array(
      'name' => $edit['name'],
    ),
  ));
  $this
    ->assertFieldByName('name', $edit['name'], 'User name found.');
}