From 747f4a4ce6e778599767d044fbc09835f3c61b57 Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Tue, 23 Sep 2008 05:11:35 +0000 Subject: [PATCH] MDL-16486 Flushing output buffer between each test, and fixed problem with update/delete of course_categories and context_temp --- lib/simpletestlib.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/simpletestlib.php b/lib/simpletestlib.php index efb3734511..f303838b69 100644 --- a/lib/simpletestlib.php +++ b/lib/simpletestlib.php @@ -259,6 +259,10 @@ class MoodleUnitTestCase extends UnitTestCase { } $DB->cleanup(); parent::tearDown(); + + // Output buffering + ob_end_flush(); + ob_start(); } /** @@ -356,7 +360,7 @@ class UnitTestDB { */ public function update_record($table, $dataobject, $bulk=false) { global $DB; - if (empty($this->table_data[$table]) || !in_array($dataobject->id, $this->table_data[$table])) { + if ((empty($this->table_data[$table]) || !in_array($dataobject->id, $this->table_data[$table])) && !($table == 'course_categories' && $dataobject->id == 1)) { // return UnitTestDB::$DB->update_record($table, $dataobject, $bulk); $a = new stdClass(); $a->id = $dataobject->id; @@ -375,6 +379,8 @@ class UnitTestDB { */ public function delete_records($table, array $conditions=array()) { global $DB; + $tables_to_ignore = array('context_temp'); + $a = new stdClass(); $a->table = $table; @@ -390,7 +396,7 @@ class UnitTestDB { } foreach ($ids_to_delete as $id) { - if (empty($this->table_data[$table]) || !in_array($id, $this->table_data[$table])) { + if (!in_array($table, $tables_to_ignore) && (empty($this->table_data[$table]) || !in_array($id, $this->table_data[$table]))) { $proceed_with_delete = false; $a->id = $id; break; -- 2.39.5