function UserLoginTest::testFailedLoginMessageWithNoPasswordResetAccess

Tests the failed login warning if there is no access to reset passwords.

File

core/modules/user/tests/src/Functional/UserLoginTest.php, line 379

Class

UserLoginTest
Ensure that login works as expected.

Namespace

Drupal\Tests\user\Functional

Code

public function testFailedLoginMessageWithNoPasswordResetAccess() : void {
  \Drupal::service('module_installer')->install([
    'user_disable_password_reset',
  ]);
  $this->drupalGet('user/login');
  $edit = [
    'name' => $this->randomMachineName(),
    'pass' => $this->randomMachineName(),
  ];
  $this->submitForm($edit, 'Log in');
  $this->assertSession()
    ->statusCodeEquals(200);
  $this->assertSession()
    ->pageTextContains('Unrecognized username or password.');
  $this->assertSession()
    ->pageTextNotContains('Forgot your password?');
}

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