You are here

public function AutologoutTest::testNoAutologoutWithRememberMe in Automated Logout 8

Tests integration with the remember me module.

Users who checked remember_me on login should never be logged out.

File

tests/src/Functional/AutologoutTest.php, line 172

Class

AutologoutTest
Tests the autologout's features.

Namespace

Drupal\Tests\autologout\Functional

Code

public function testNoAutologoutWithRememberMe() {

  // Set the remember_me module data bit to TRUE.
  $this->userData
    ->set('remember_me', $this->privilegedUser
    ->id(), 'remember_me', TRUE);

  // Check that the user can access the page after login.
  $this
    ->drupalGet('node');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  self::assertTrue($this
    ->drupalUserIsLoggedIn($this->privilegedUser));

  // Wait for timeout period to elapse.
  sleep(15);

  // Check we are still logged in.
  $this
    ->drupalGet('node');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  self::assertTrue($this
    ->drupalUserIsLoggedIn($this->privilegedUser));
}