You are here

public function LoginSecurityTestBase::setUp in Login Security 8

Sets up a Drupal site for running functional and integration tests.

Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.

Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Overrides WebTestBase::setUp

3 calls to LoginSecurityTestBase::setUp()
LoginSecurityEmailTest::setUp in src/Tests/LoginSecurityEmailTest.php
Sets up a Drupal site for running functional and integration tests.
LoginSecurityInterfaceTest::setUp in src/Tests/LoginSecurityInterfaceTest.php
Sets up a Drupal site for running functional and integration tests.
LoginSecurityUserBlockingTest::setUp in src/Tests/LoginSecurityUserBlockingTest.php
Sets up a Drupal site for running functional and integration tests.
3 methods override LoginSecurityTestBase::setUp()
LoginSecurityEmailTest::setUp in src/Tests/LoginSecurityEmailTest.php
Sets up a Drupal site for running functional and integration tests.
LoginSecurityInterfaceTest::setUp in src/Tests/LoginSecurityInterfaceTest.php
Sets up a Drupal site for running functional and integration tests.
LoginSecurityUserBlockingTest::setUp in src/Tests/LoginSecurityUserBlockingTest.php
Sets up a Drupal site for running functional and integration tests.

File

src/Tests/LoginSecurityTestBase.php, line 18

Class

LoginSecurityTestBase
Helper test class with some added functions for testing.

Namespace

Drupal\login_security\Tests

Code

public function setUp() {
  parent::setUp();

  // Ensure these tables have no entries.
  db_query("TRUNCATE TABLE {login_security_track}");
  db_query("TRUNCATE TABLE {ban_ip}");

  // Set time tracking window to 1 hour.
  \Drupal::configFactory()
    ->getEditable('login_security.settings')
    ->set('track_time', 1)
    ->save();
}