You are here

public function AutologoutTestCase::testAutologoutDefaultTimeout in Automated Logout 7.4

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

Test a user is logged out after the default timeout period.

File

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

Class

AutologoutTestCase
Tests the autologout's features.

Code

public function testAutologoutDefaultTimeout() {

  // 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 for timeout period to elapse.
  sleep(20);

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