diff --git a/lib/testing/classes/util.php b/lib/testing/classes/util.php index 1b08d6ff86a..e0b8c3a796c 100644 --- a/lib/testing/classes/util.php +++ b/lib/testing/classes/util.php @@ -638,7 +638,11 @@ abstract class testing_util { foreach ($data as $table => $records) { if ($borkedmysql) { - if (empty($records) and isset($empties[$table])) { + if (empty($records)) { + if (!isset($empties[$table])) { + // Table has been modified and is not empty. + $DB->delete_records($table, null); + } continue; } @@ -660,9 +664,8 @@ abstract class testing_util { } if (empty($records)) { - if (isset($empties[$table])) { - // table was not modified and is empty - } else { + if (!isset($empties[$table])) { + // Table has been modified and is not empty. $DB->delete_records($table, array()); } continue;