diff --git a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php index 03990d8e46..82685a9320 100644 --- a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php +++ b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php @@ -669,11 +669,11 @@ protected function prepareEnvironment() { * An array of available database driver installer objects. */ protected function getDatabaseTypes() { - if ($this->originalContainer) { + if (isset($this->originalContainer) && $this->originalContainer) { \Drupal::setContainer($this->originalContainer); } $database_types = drupal_get_database_types(); - if ($this->originalContainer) { + if (isset($this->originalContainer) && $this->originalContainer) { \Drupal::unsetContainer(); } return $database_types; diff --git a/core/tests/Drupal/Setup/Commands/TestInstallationSetupCommand.php b/core/tests/Drupal/Setup/Commands/TestInstallationSetupCommand.php index d36d5e1a79..9262499a72 100644 --- a/core/tests/Drupal/Setup/Commands/TestInstallationSetupCommand.php +++ b/core/tests/Drupal/Setup/Commands/TestInstallationSetupCommand.php @@ -2,7 +2,6 @@ namespace Drupal\Setup\Commands; -use Drupal\Core\Database\Database; use Drupal\Core\DrupalKernel; use Drupal\Core\Site\Settings; use Drupal\Core\Test\FunctionalTestSetupTrait; @@ -23,7 +22,9 @@ */ class TestInstallationSetupCommand extends Command { - use FunctionalTestSetupTrait; + use FunctionalTestSetupTrait { + installParameters as protected installParametersTrait; + } use RandomGeneratorTrait; use SessionTestTrait; use TestSetupTrait; @@ -191,42 +192,8 @@ protected function executeSetupClass($class) { * {@inheritdoc} */ protected function installParameters() { - $connection_info = Database::getConnectionInfo(); - $driver = $connection_info['default']['driver']; - $connection_info['default']['prefix'] = $connection_info['default']['prefix']['default']; - unset($connection_info['default']['driver']); - unset($connection_info['default']['namespace']); - unset($connection_info['default']['pdo']); - unset($connection_info['default']['init_commands']); - $parameters = [ - 'interactive' => FALSE, - 'parameters' => [ - 'profile' => $this->profile, - 'langcode' => $this->langcode, - ], - 'forms' => [ - 'install_settings_form' => [ - 'driver' => $driver, - $driver => $connection_info['default'], - ], - 'install_configure_form' => [ - 'site_name' => 'Drupal', - 'site_mail' => 'simpletest@example.com', - 'account' => [ - 'name' => $this->rootUser->name, - 'mail' => $this->rootUser->getEmail(), - 'pass' => [ - 'pass1' => $this->rootUser->pass_raw, - 'pass2' => $this->rootUser->pass_raw, - ], - ], - // form_type_checkboxes_value() requires NULL instead of FALSE values - // for programmatic form submissions to disable a checkbox. - 'enable_update_status_module' => NULL, - 'enable_update_status_emails' => NULL, - ], - ], - ]; + $parameters = $this->installParametersTrait(); + $parameters['parameters']['langcode'] = $this->langcode; return $parameters; }