You are here

public function SessionLimitBaseTestCase::restoreSession in Session Limit 7.2

Same name and namespace in other branches
  1. 8 tests/session_limit.test \SessionLimitBaseTestCase::restoreSession()
  2. 6.2 tests/session_limit.test \SessionLimitBaseTestCase::restoreSession()
  3. 2.x tests/session_limit.test \SessionLimitBaseTestCase::restoreSession()

Restore a previously stashed session.

Parameters

string $session_id: The session to restore as returned by stashSession(); This is also the path to the cookie file.

Return value

string The old session id that was replaced.

3 calls to SessionLimitBaseTestCase::restoreSession()
SessionLimitBaseTestCase::assertSessionLogout in tests/session_limit.test
Test that an individual user can have up to a specifed number of sessions.
SessionLimitBaseTestCase::assertSessionPrevent in tests/session_limit.test
Test that new sessions cannot be created past a maximum.
SessionLimitSessionTestCase::testSessionStashAndRestore in tests/session_limit.test
Test session stash and restore.

File

tests/session_limit.test, line 229
Simpletest tests for session_limit.

Class

SessionLimitBaseTestCase
Base test for session limits.

Code

public function restoreSession($session_id) {
  $old_session_id = NULL;
  if (isset($this->curlHandle)) {
    $old_session_id = $this
      ->stashSession();
  }

  // Restore the specified session.
  $this->curlHandle = $this->curlHandles[$session_id];
  $this->cookieFile = $session_id;
  $this->loggedInUser = $this->loggedInUsers[$session_id];
  return $old_session_id;
}