You are here

function SessionApiTestCase::sessionReset in Session API 7

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

Parameters

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

1 call to SessionApiTestCase::sessionReset()
SessionApiTestCase::testFunctions in ./session_api.test
Verify functions work properly.

File

./session_api.test, line 35
Session API tests.

Class

SessionApiTestCase
Session API test class.

Code

function sessionReset($uid = 0) {

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

  // Change cookie file for user.
  $this->cookieFile = drupal_realpath('public://cookie.' . $uid . '.txt');
  $this->additionalCurlOptions[CURLOPT_COOKIEFILE] = $this->cookieFile;
  $this->additionalCurlOptions[CURLOPT_COOKIESESSION] = TRUE;
  $this
    ->drupalGet('session-api-test');
  $this
    ->assertResponse(200, t('Session API test module is correctly enabled.'), t('Session API'));
}