You are here

public function LoginSecuritySoftBlockTest::testLogin in Login Security 8

Test login attempts.

File

src/Tests/LoginSecuritySoftBlockTest.php, line 40

Class

LoginSecuritySoftBlockTest
Test Login Security's soft blocking restrictions.

Namespace

Drupal\login_security\Tests

Code

public function testLogin() {

  // Set wrong count to 5 attempts.
  \Drupal::configFactory()
    ->getEditable('login_security.settings')
    ->set('user_wrong_count', 5)
    ->save();
  $normal_user = $this
    ->drupalCreateUser();
  $this
    ->drupalLogin($normal_user);
  $warning_message = 'You have used 1 out of 5 login attempts. After all 5 have been used, you will be unable to login.';
  $this
    ->assertNoText($warning_message, 'Attempts available message displayed.');
}