diff -u b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php --- b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php @@ -639,4 +639,7 @@ $this->originalUser = clone $user; + // Ensure that the current session is not changed by the new environment. + drupal_save_session(FALSE); + // Save and clean the shutdown callbacks array because it is static cached // and will be changed by the test run. Otherwise it will contain callbacks diff -u b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php --- b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -609,9 +609,8 @@ // @see drupal_system_listing() $conf['simpletest_parent_profile'] = $this->originalProfile; - // Run the Drupal installer non-interactively. + // Set installer parameters. // @see install.php, install.core.inc - require_once DRUPAL_ROOT . '/core/includes/install.core.inc'; $connection_info = Database::getConnectionInfo('default'); $this->root_user = (object) array( 'name' => 'admin', @@ -653,22 +652,20 @@ ), ); - // Reset the batch and invoke the non-interactive installer. - $batch = &batch_get(); - $batch = array(); - - // Ensure that the session is not changed by the new environment. - drupal_save_session(FALSE); - // Replace the global $user session with an anonymous user to resemble a // regular installation. $user = drupal_anonymous_user(); + // Reset the static batch to remove Simpletest's batch operations. + $batch = &batch_get(); + $batch = array(); + // The installer sets/overrides some services to Null implementations, since // there is no database yet. Thus, backup and restore the current $conf. $originalConf = $conf; - + // Execute the non-interactive installer. + require_once DRUPAL_ROOT . '/core/includes/install.core.inc'; install_drupal($settings); // Restore global $conf from before install_begin_request().