diff -u b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php --- b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -759,6 +759,12 @@ * and reset the database prefix. */ protected function tearDown() { + // Ensure that TestBase::changeDatabasePrefix() has run and TestBase::$setup + // was not tricked into TRUE, since the following code would delete the + // entire parent site otherwise. + if (!$this->setupDatabasePrefix) { + return FALSE; + } // Remove all prefixed tables. $connection_info = Database::getConnectionInfo('default'); $tables = db_find_tables($connection_info['default']['prefix']['default'] . '%');