You are here

function SessionTestCase::sessionReset in Drupal 7

Reset the cookie file so that it refers to the specified user.

Parameters

$uid User id to set as the active session.:

9 calls to SessionTestCase::sessionReset()
SessionTestCase::testDataPersistence in modules/simpletest/tests/session.test
Test data persistence via the session_test module callbacks.
SessionTestCase::testNoSameSiteCookieAttributeDefault in modules/simpletest/tests/session.test
Test absence of SameSite attribute on session cookies by default.
SessionTestCase::testSameSiteCookieAttributeDisabledViaConf in modules/simpletest/tests/session.test
Test disabling the samesite attribute on session cookies via $conf
SessionTestCase::testSameSiteCookieAttributeLax in modules/simpletest/tests/session.test
Test SameSite attribute = Lax on session cookies.
SessionTestCase::testSameSiteCookieAttributeNone in modules/simpletest/tests/session.test
Test SameSite attribute = None on session cookies.

... See full list

File

modules/simpletest/tests/session.test, line 433
Provides SimpleTests for core session handling functionality.

Class

SessionTestCase
@file Provides SimpleTests for core session handling functionality.

Code

function sessionReset($uid = 0) {

  // Close the internal browser.
  $this
    ->curlClose();
  $this->loggedInUser = FALSE;

  // Change cookie file for user.
  $this->cookieFile = file_stream_wrapper_get_instance_by_scheme('temporary')
    ->getDirectoryPath() . '/cookie.' . $uid . '.txt';
  $this->additionalCurlOptions[CURLOPT_COOKIEFILE] = $this->cookieFile;
  $this->additionalCurlOptions[CURLOPT_COOKIESESSION] = TRUE;
  $this
    ->drupalGet('session-test/get');
  $this
    ->assertResponse(200, 'Session test module is correctly enabled.', 'Session');
}