diff --git a/core/lib/Drupal/Core/Database/Install/Tasks.php b/core/lib/Drupal/Core/Database/Install/Tasks.php index ee9c23e..9cbd50f 100644 --- a/core/lib/Drupal/Core/Database/Install/Tasks.php +++ b/core/lib/Drupal/Core/Database/Install/Tasks.php @@ -7,7 +7,6 @@ namespace Drupal\Core\Database\Install; -use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Database\Database; /** @@ -148,14 +147,19 @@ public function runTasks() { } } // Check for failed results and compile message - $message = ''; + $errors = []; foreach ($this->results as $result => $success) { if (!$success) { - $message = SafeMarkup::isSafe($result) ? $result : SafeMarkup::checkPlain($result); + $errors[] = $result; } } - if (!empty($message)) { - $message = SafeMarkup::set('Resolve all issues below to continue the installation. For help configuring your database server, see the installation handbook, or contact your hosting provider.' . $message); + if ($errors) { + $error_list = [ + '#theme' => 'item_list', + '#items' => $errors, + ]; + $error_list = \Drupal::service('renderer')->renderPlain($error_list); + $message = t('Resolve all issues below to continue the installation. For help configuring your database server, see the installation handbook, or contact your hosting provider.@errors', ['@errors' => $error_list]); throw new TaskException($message); } } diff --git a/core/modules/simpletest/src/InstallerTestBase.php b/core/modules/simpletest/src/InstallerTestBase.php index c340c92..814160d 100644 --- a/core/modules/simpletest/src/InstallerTestBase.php +++ b/core/modules/simpletest/src/InstallerTestBase.php @@ -156,15 +156,6 @@ protected function setUp() { $this->kernel = DrupalKernel::createFromRequest($request, $class_loader, 'prod', FALSE); $this->kernel->prepareLegacyRequest($request); $this->container = $this->kernel->getContainer(); - $config = $this->container->get('config.factory'); - - // Manually configure the test mail collector implementation to prevent - // tests from sending out e-mails and collect them in state instead. - $config->getEditable('system.mail') - ->set('interface.default', 'test_mail_collector') - ->save(); - - $this->isInstalled = TRUE; } /** @@ -196,11 +187,20 @@ protected function setUpSettings() { } /** - * Installer step: Configure site. + * Final installer step: Configure site. */ protected function setUpSite() { $edit = $this->translatePostValues($this->parameters['forms']['install_configure_form']); $this->drupalPostForm(NULL, $edit, $this->translations['Save and continue']); + + // 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') + ->getEditable('system.mail') + ->set('interface.default', 'test_mail_collector') + ->save(); + + $this->isInstalled = TRUE; } /** diff --git a/core/modules/system/src/Tests/Installer/InstallerDatabaseErrorMessagesTest.php b/core/modules/system/src/Tests/Installer/InstallerDatabaseErrorMessagesTest.php new file mode 100644 index 0000000..2452c40 --- /dev/null +++ b/core/modules/system/src/Tests/Installer/InstallerDatabaseErrorMessagesTest.php @@ -0,0 +1,46 @@ +query('CREATE TABLE {drupal_install_test} (id int NULL)'); + parent::setUpSettings(); + } + + /** + * @{inheritdoc} + */ + protected function setUpSite() { + // This step should not appear as we had a failure on the settings screen. + } + + /** + * Verifies that the error message in the settings step is correct. + */ + public function testSetUpSettingsErrorMessage() { + $this->assertRaw('