MDL-52799 phpunit: Truncate records for brokedmysql not empty.
authorRajesh Taneja <rajesh@moodle.com>
Mon, 18 Jan 2016 05:56:18 +0000 (13:56 +0800)
committerRajesh Taneja <rajesh@moodle.com>
Mon, 18 Jan 2016 06:10:18 +0000 (14:10 +0800)
lib/testing/classes/util.php

index 1017b1b..d8ce19a 100644 (file)
@@ -685,7 +685,12 @@ abstract class testing_util {
             }
 
             if ($borkedmysql) {
-                if (empty($records) and isset($empties[$table])) {
+                if (empty($records)) {
+                    if (isset($empties[$table])) {
+                        // Table was not modified and is empty.
+                    } else {
+                        $DB->delete_records($table, null);
+                    }
                     continue;
                 }