diff core/lib/Drupal/Core/Test/TestSetupTrait.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
line wrap: on
line diff
--- a/core/lib/Drupal/Core/Test/TestSetupTrait.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/core/lib/Drupal/Core/Test/TestSetupTrait.php	Thu Feb 28 13:21:36 2019 +0000
@@ -158,6 +158,9 @@
     // If the test is run with argument dburl then use it.
     $db_url = getenv('SIMPLETEST_DB');
     if (!empty($db_url)) {
+      // Ensure no existing database gets in the way. If a default database
+      // exists already it must be removed.
+      Database::removeConnection('default');
       $database = Database::convertDbUrlToConnectionInfo($db_url, isset($this->root) ? $this->root : DRUPAL_ROOT);
       Database::addConnectionInfo('default', 'default', $database);
     }