]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16486 Flushing output buffer between each test, and fixed problem with update...
authornicolasconnault <nicolasconnault>
Tue, 23 Sep 2008 05:11:35 +0000 (05:11 +0000)
committernicolasconnault <nicolasconnault>
Tue, 23 Sep 2008 05:11:35 +0000 (05:11 +0000)
lib/simpletestlib.php

index efb3734511aa1f98b6c36d36829995375d591a19..f303838b69be4c9f925f013ddd64677d61c1cc4d 100644 (file)
@@ -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;