You are here

public function LoginTest::testForceLogout in Restrict Login or Role Access by IP Address 8.4

File

src/Tests/LoginTest.php, line 83

Class

LoginTest
Tests logins are restricted to certain IP address range(s).

Namespace

Drupal\restrict_by_ip\Tests

Code

public function testForceLogout() {

  // First login
  $this
    ->drupalLogin($this->regularUser);

  // Add out of range global IP.
  $this->conf
    ->set('login_range', $this->outOfRangeCIDR)
    ->save();

  // Load any page, and check if logged out.
  $this->dumpHeaders = TRUE;
  $this
    ->drupalGet('user');
  $this
    ->assertFalse($this
    ->drupalUserIsLoggedIn($this->regularUser), t('User logged out.'));
}