protected function UpgradePathTestCase::prepareD7Session

7.x upgrade.test protected UpgradePathTestCase::prepareD7Session()

Prepares the appropriate session for the release of Drupal being upgraded.

1 call to UpgradePathTestCase::prepareD7Session()
UpgradePathTestCase::setUp in drupal/modules/simpletest/tests/upgrade/upgrade.test
Overrides DrupalWebTestCase::setUp() for upgrade testing.
1 method overrides UpgradePathTestCase::prepareD7Session()
UpdatePathTestCase::prepareD7Session in drupal/modules/simpletest/tests/upgrade/upgrade.test
Overrides UpgradePathTestCase::prepareD7Session().


drupal/modules/simpletest/tests/upgrade/upgrade.test, line 55


Perform end-to-end tests of the upgrade path.


protected function prepareD7Session() {
  // Generate and set a D6-compatible session cookie.
  $sid = drupal_hash_base64(uniqid(mt_rand(), TRUE) . drupal_random_bytes(55));
  $session_name = update_get_d6_session_name();
  curl_setopt($this->curlHandle, CURLOPT_COOKIE, rawurlencode($session_name) . '=' . rawurlencode($sid));

  // Force our way into the session of the child site.
  // A session cannot be written without the ssid column which is missing on
  // Drupal 6 sites.
  db_add_field('sessions', 'ssid', array('description' => "Secure session ID. The value is generated by Drupal's session handlers.", 'type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''));
  _drupal_session_write($sid, '');
  // Remove the temporarily added ssid column.
  db_drop_field('sessions', 'ssid');