You are here

public function AutologoutTestCase::testNoAutologoutWithRememberMe in Automated Logout 7.4

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

Test integration with the remember me module.

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

File

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

Class

AutologoutTestCase
Tests the autologout's features.

Code

public function testNoAutologoutWithRememberMe() {

  // Set the remember_me module data bit to TRUE.
  $this->privileged_user->data['remember_me'] = TRUE;
  user_save($this->privileged_user);

  // 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 still logged in.
  $this
    ->drupalGet('node');
  $this
    ->assertResponse(200, t('Homepage is accessible'));
  $this
    ->assertText(t('Log out'), t('User is still logged in after timeout with remember_me on.'));
}