You are here

protected function LoginSecurityUserBlockingTest::assertBlockedUser in Login Security 2.x

Asserts a blocked user log was set.

Parameters

object $log: The raw log record from the database.

string $username: The blocked username.

1 call to LoginSecurityUserBlockingTest::assertBlockedUser()
LoginSecurityUserBlockingTest::testThresholdNotify in tests/src/Functional/LoginSecurityUserBlockingTest.php
Test threshold notify functionality.

File

tests/src/Functional/LoginSecurityUserBlockingTest.php, line 108

Class

LoginSecurityUserBlockingTest
Test Login Security's user-blocking restrictions and default messages.

Namespace

Drupal\Tests\login_security\Functional

Code

protected function assertBlockedUser($log, $username) {
  $variables = [
    '@username' => $username,
  ];
  $expected = new FormattableMarkup('Blocked user @username due to security configuration.', $variables);
  $this
    ->assertEqual(new FormattableMarkup($log->message, unserialize($log->variables)), $expected, 'User blocked log was set.');
  $this
    ->assertEqual($log->severity, RfcLogLevel::NOTICE, 'User blocked log was of severity "Notice".');
}