Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / lib / Drupal / Core / Test / TestSetupTrait.php
index 44409078dbf3854670711937948c404d887beb36..0625691022cd451bde0804482f593089a792f654 100644 (file)
@@ -158,6 +158,9 @@ trait TestSetupTrait {
     // 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);
     }