You are here

public function SessionLimitBaseTestCase::closeAllSessions in Session Limit 2.x

Same name in this branch
  1. 2.x tests/session_limit.test \SessionLimitBaseTestCase::closeAllSessions()
  2. 2.x tests/SessionLimitBaseTestCase.php \Drupal\session_limit\SessionLimitBaseTestCase::closeAllSessions()
Same name and namespace in other branches
  1. 8 tests/SessionLimitBaseTestCase.php \Drupal\session_limit\SessionLimitBaseTestCase::closeAllSessions()

Close all stashed sessions and the current session.

4 calls to SessionLimitBaseTestCase::closeAllSessions()
SessionLimitLogoutTestCase::testSessionLogoutOnMax1 in tests/SessionLimitLogoutTestCase.php
Test user can only have 1 session, logout oldest.
SessionLimitLogoutTestCase::testSessionLogoutOnMax2 in tests/SessionLimitLogoutTestCase.php
Test user can only have 2 sessions, logout oldest.
SessionLimitPreventTestCase::testSessionPreventOnMax1 in tests/SessionLimitPreventTestCase.php
Test user can only have 1 session, prevent new sessions.
SessionLimitPreventTestCase::testSessionPreventOnMax2 in tests/SessionLimitPreventTestCase.php
Test user can only have 2 sessions, prevent new sessions.

File

tests/SessionLimitBaseTestCase.php, line 243

Class

SessionLimitBaseTestCase
Base test for session limits.

Namespace

Drupal\session_limit

Code

public function closeAllSessions() {
  foreach ($this->curlHandles as $cookie_file => $curl_handle) {
    if (isset($curl_handle)) {
      curl_close($curl_handle);
    }
  }

  // Make the server forget all sessions.
  db_truncate('sessions')
    ->execute();
  $this->curlHandles = array();
  $this->loggedInUsers = array();
  $this->loggedInUser = FALSE;
  $this->cookieFile = $this->public_files_directory . '/' . $this
    ->randomName() . '.jar';
  unset($this->curlHandle);
}