public function AutologoutTest::testAutologoutNoLogoutInsideTimeout in Automated Logout 8
Tests a user is not logged out within the default timeout period.
File
- tests/
src/ Functional/ AutologoutTest.php, line 127
Class
- AutologoutTest
- Tests the autologout's features.
Namespace
Drupal\Tests\autologout\FunctionalCode
public function testAutologoutNoLogoutInsideTimeout() {
// Check that the user can access the page after login.
$this
->drupalGet('node');
$this
->assertSession()
->statusCodeEquals(200);
self::assertTrue($this
->drupalUserIsLoggedIn($this->privilegedUser));
// Wait within the timeout period.
sleep(5);
// Check we are still logged in.
$this
->drupalGet('node');
$this
->assertSession()
->statusCodeEquals(200);
self::assertTrue($this
->drupalUserIsLoggedIn($this->privilegedUser));
}