protected function UpgradePathTestBase::prepareD8Session

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

1 call to UpgradePathTestBase::prepareD8Session()
UpgradePathTestBase::setUp in drupal/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php
Overrides Drupal\simpletest\WebTestBase::setUp() for upgrade testing.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php, line 45
Definition of Drupal\system\Tests\Upgrade\UpgradePathTestBase.

Class

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

Namespace

Drupal\system\Tests\Upgrade

Code

protected function prepareD8Session() {

  // 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);
}