function UserPasswordResetTestCase::testUserPasswordTextboxFilled

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

File

modules/user/user.test, line 796

Class

UserPasswordResetTestCase
Tests resetting a user password.

Code

function testUserPasswordTextboxFilled() {
    $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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.