Commit e014859c authored by catch's avatar catch

Issue #2807171 by alexpott: Use the correct testing table prefix in simpletest_clean_database()

parent 68a880ab
......@@ -673,13 +673,12 @@ function simpletest_clean_environment() {
* Removes prefixed tables from the database from crashed tests.
*/
function simpletest_clean_database() {
$tables = db_find_tables(Database::getConnection()->prefixTables('{simpletest}') . '%');
$schema = drupal_get_module_schema('simpletest');
$tables = db_find_tables('test%');
$count = 0;
foreach (array_diff_key($tables, $schema) as $table) {
// Strip the prefix and skip tables without digits following "simpletest",
// e.g. {simpletest_test_id}.
if (preg_match('/simpletest\d+.*/', $table, $matches)) {
foreach ($tables as $table) {
// Only drop tables which begin wih 'test' followed by digits, for example,
// {test12345678node__body}.
if (preg_match('/^test\d+.*/', $table, $matches)) {
db_drop_table($matches[0]);
$count++;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment