diff -u b/core/modules/simpletest/src/InstallerTestBase.php b/core/modules/simpletest/src/InstallerTestBase.php --- b/core/modules/simpletest/src/InstallerTestBase.php +++ b/core/modules/simpletest/src/InstallerTestBase.php @@ -137,25 +137,6 @@ // Configure site. $this->setUpSite(); - - // Import new settings.php written by the installer. - $request = Request::createFromGlobals(); - $class_loader = require $this->container->get('app.root') . '/autoload.php'; - Settings::initialize($this->container->get('app.root'), DrupalKernel::findSitePath($request), $class_loader); - foreach ($GLOBALS['config_directories'] as $type => $path) { - $this->configDirectories[$type] = $path; - } - - // After writing settings.php, the installer removes write permissions - // from the site directory. To allow drupal_generate_test_ua() to write - // a file containing the private key for drupal_valid_test_ua(), the site - // directory has to be writable. - // WebTestBase::tearDown() will delete the entire test site directory. - // Not using File API; a potential error must trigger a PHP warning. - chmod($this->container->get('app.root') . '/' . $this->siteDirectory, 0777); - $this->kernel = DrupalKernel::createFromRequest($request, $class_loader, 'prod', FALSE); - $this->kernel->prepareLegacyRequest($request); - $this->container = $this->kernel->getContainer(); } /** @@ -193,6 +174,25 @@ $edit = $this->translatePostValues($this->parameters['forms']['install_configure_form']); $this->drupalPostForm(NULL, $edit, $this->translations['Save and continue']); + // Import new settings.php written by the installer. + $request = Request::createFromGlobals(); + $class_loader = require $this->container->get('app.root') . '/autoload.php'; + Settings::initialize($this->container->get('app.root'), DrupalKernel::findSitePath($request), $class_loader); + foreach ($GLOBALS['config_directories'] as $type => $path) { + $this->configDirectories[$type] = $path; + } + + // After writing settings.php, the installer removes write permissions + // from the site directory. To allow drupal_generate_test_ua() to write + // a file containing the private key for drupal_valid_test_ua(), the site + // directory has to be writable. + // WebTestBase::tearDown() will delete the entire test site directory. + // Not using File API; a potential error must trigger a PHP warning. + chmod($this->container->get('app.root') . '/' . $this->siteDirectory, 0777); + $this->kernel = DrupalKernel::createFromRequest($request, $class_loader, 'prod', FALSE); + $this->kernel->prepareLegacyRequest($request); + $this->container = $this->kernel->getContainer(); + // Manually configure the test mail collector implementation to prevent // tests from sending out e-mails and collect them in state instead. $this->container->get('config.factory')