You are here

public function AutologoutTestCase::testAutologoutNoLogoutInsideTimeout in Automated Logout 7.4

Same name and namespace in other branches
  1. 6.4 tests/autologout.test \AutologoutTestCase::testAutologoutNoLogoutInsideTimeout()

Test a user is not logged out within the default timeout period.

File

tests/autologout.test, line 299
Simpletest tests for autologout.

Class

AutologoutTestCase
Tests the autologout's features.

Code

public function testAutologoutNoLogoutInsideTimeout() {

  // Check that the user can access the page after login.
  $this
    ->drupalGet('node');
  $this
    ->assertResponse(200, t('Homepage is accessible'));
  $this
    ->assertText(t('Log out'), t('User is still logged in.'));

  // Wait within the timeout period.
  sleep(10);

  // Check we are still logged in.
  $this
    ->drupalGet('node');
  $this
    ->assertResponse(200, t('Homepage is accessible'));
  $this
    ->assertText(t('Log out'), t('User is still logged in.'));
  $this
    ->assertNoText(t('You have been logged out due to inactivity.'), t('User does not see inactivity message.'));
}