diff --git a/core/modules/simpletest/src/KernelTestBase.php b/core/modules/simpletest/src/KernelTestBase.php
index f26c5d4..c6b65c0 100644
--- a/core/modules/simpletest/src/KernelTestBase.php
+++ b/core/modules/simpletest/src/KernelTestBase.php
@@ -136,10 +136,29 @@ protected function setUp() {
     $this->keyValueFactory = new KeyValueMemoryFactory();
 
     // Allow for test-specific overrides.
+    $directory = DRUPAL_ROOT . '/' . $this->siteDirectory;
+    $settings_testing_file = DRUPAL_ROOT . '/' . $this->originalSite . '/settings.testing.php';
+    if (file_exists($settings_testing_file)) {
+      // Copy the testing-specific settings.php overrides in place.
+      copy($settings_testing_file, $directory . '/settings.testing.php');
+      // Add the name of the testing class to settings.php and include the
+      // testing specific overrides
+      $hash_salt = Settings::getHashSalt();
+      $test_class = get_class($this);
+      $php = <<<EOD
+<?php
+
+\$settings['hash_salt'] = '$hash_salt';
+
+\$test_class = '$test_class';
+include DRUPAL_ROOT . '/' . \$site_path . '/settings.testing.php';
+EOD;
+      file_put_contents($directory . '/settings.php', $php);
+    }
     $settings_services_file = DRUPAL_ROOT . '/' . $this->originalSite . '/testing.services.yml';
     if (file_exists($settings_services_file)) {
       // Copy the testing-specific service overrides in place.
-      copy($settings_services_file, DRUPAL_ROOT . '/' . $this->siteDirectory . '/services.yml');
+      copy($settings_services_file, $directory . '/services.yml');
     }
 
     // Create and set new configuration directories.
@@ -155,12 +174,12 @@ protected function setUp() {
     $class_loader = require DRUPAL_ROOT . '/core/vendor/autoload.php';
     $this->kernel = new DrupalKernel('testing', $class_loader, FALSE);
     $request = Request::create('/');
-    $this->kernel->setSitePath(DrupalKernel::findSitePath($request));
+    $site_path = DrupalKernel::findSitePath($request);
+    $this->kernel->setSitePath($site_path);
+    Settings::initialize(DRUPAL_ROOT, $site_path, $class_loader);
     $this->kernel->boot();
 
     // Restore and merge settings.
-    // DrupalKernel::boot() initializes new Settings, and the containerBuild()
-    // method sets additional settings.
     new Settings($settings + Settings::getAll());
 
     // Set the request scope.
