You are here

protected function UpdatePathTestCase::prepareD7Session in Drupal 7

Overrides UpgradePathTestCase::prepareD7Session().

Overrides UpgradePathTestCase::prepareD7Session

File

modules/simpletest/tests/upgrade/upgrade.test, line 315

Class

UpdatePathTestCase
Performs end-to-end point test of the release update path.

Code

protected function prepareD7Session() {

  // Generate and set a D7-compatible session cookie.
  $this
    ->curlInitialize();
  $sid = drupal_hash_base64(uniqid(mt_rand(), TRUE) . drupal_random_bytes(55));
  curl_setopt($this->curlHandle, CURLOPT_COOKIE, rawurlencode(session_name()) . '=' . rawurlencode($sid));

  // Force our way into the session of the child site.
  drupal_save_session(TRUE);
  _drupal_session_write($sid, '');
  drupal_save_session(FALSE);
}