diff --git a/core/lib/Drupal/Core/Database/Install/Tasks.php b/core/lib/Drupal/Core/Database/Install/Tasks.php index ee9c23e..24dc41d 100644 --- a/core/lib/Drupal/Core/Database/Install/Tasks.php +++ b/core/lib/Drupal/Core/Database/Install/Tasks.php @@ -148,14 +148,25 @@ public function runTasks() { } } // Check for failed results and compile message - $message = ''; + $failure = FALSE; + $error = []; foreach ($this->results as $result => $success) { if (!$success) { - $message = SafeMarkup::isSafe($result) ? $result : SafeMarkup::checkPlain($result); + $failure = TRUE; + $error[] = $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 ($failure) { + $message = array( + 'error' => array( + '#markup' => t('Resolve all issues below to continue the installation. For help configuring your database server, see the installation handbook, or contact your hosting provider.'), + ), + 'item_list' => array( + '#theme' => 'item_list', + '#items' => $error, + ), + ); + $message = \Drupal::service('renderer')->render(($message), 'error'); throw new TaskException($message); } } diff --git a/core/modules/system/src/Tests/Installer/InstallerNotValidDatabaseSettingsTest.php b/core/modules/system/src/Tests/Installer/InstallerNotValidDatabaseSettingsTest.php new file mode 100644 index 0000000..050c810 --- /dev/null +++ b/core/modules/system/src/Tests/Installer/InstallerNotValidDatabaseSettingsTest.php @@ -0,0 +1,55 @@ +settings['databases']['default'] = (object) array( + 'value' => $connection_info, + 'required' => TRUE, + ); + parent::setUp(); + } + + /** + * For testing database failures. + */ + public function testDatabaseMultipleFailure() { + // All database settings should be pre-configured, except password. + $values = $this->parameters['forms']['install_settings_form']; + $driver = $values['driver']; + $edit = array(); + if (isset($values[$driver]['password']) && $values[$driver]['password'] === '') { + $edit = $this->translatePostValues(array( + $driver => array( + 'password' => $this->randomMachineName(), + ), + )); + } + $this->drupalPostForm(NULL, $edit, $this->translations['Save and continue']); + } + +}