You are here

public function AutologoutSessionCleanupOnLoginTest::restoreSession in Automated Logout 8

Restores 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.

1 call to AutologoutSessionCleanupOnLoginTest::restoreSession()
AutologoutSessionCleanupOnLoginTest::testSessionCleanupAtLogin in tests/src/Functional/AutologoutSessionCleanupOnLoginTest.php
Tests that stale sessions are cleaned up at login.

File

tests/src/Functional/AutologoutSessionCleanupOnLoginTest.php, line 201

Class

AutologoutSessionCleanupOnLoginTest
Tests session cleanup on login.

Namespace

Drupal\Tests\autologout\Functional

Code

public function restoreSession($session_id) {
  $old_session_id = NULL;
  if (isset($this->loggedInUsers[$session_id])) {
    $old_session_id = $this
      ->stashSession();
  }
  $this->mink
    ->setDefaultSessionName($session_id);
  $this->loggedInUser = $this->loggedInUsers[$session_id];
  $this->privilegedUser = $this->loggedInUsers[$session_id];
  $this->loggedInUser->sessionId = $session_id;
  $this->privilegedUser->sessionId = $session_id;
  return $old_session_id;
}