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 @@ -773,6 +773,10 @@ if (!$this->setupDatabasePrefix) { return FALSE; } + // Destroy the testing kernel. + if (isset($this->kernel)) { + $this->kernel->shutdown(); + } // Remove all prefixed tables. $connection_info = Database::getConnectionInfo('default'); $tables = db_find_tables($connection_info['default']['prefix']['default'] . '%'); @@ -807,11 +811,6 @@ // Rebuild caches. $this->refreshVariables(); - // Destroy the testing kernel. - if (isset($this->kernel)) { - $this->kernel->shutdown(); - } - // Close the CURL handler. $this->curlClose(); }