Skip to content

Commit

Permalink
MDL-16486 Flushing output buffer between each test, and fixed problem…
Browse files Browse the repository at this point in the history
… with update/delete of course_categories and context_temp
  • Loading branch information
nicolasconnault committed Sep 23, 2008
1 parent c0d551f commit 747f4a4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/simpletestlib.php
Expand Up @@ -259,6 +259,10 @@ public function tearDown() {
}
$DB->cleanup();
parent::tearDown();

// Output buffering
ob_end_flush();
ob_start();
}

/**
Expand Down Expand Up @@ -356,7 +360,7 @@ public function insert_record($table, $dataobject, $returnid=true, $bulk=false)
*/
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;
Expand All @@ -375,6 +379,8 @@ public function update_record($table, $dataobject, $bulk=false) {
*/
public function delete_records($table, array $conditions=array()) {
global $DB;
$tables_to_ignore = array('context_temp');

$a = new stdClass();
$a->table = $table;

Expand All @@ -390,7 +396,7 @@ public function delete_records($table, array $conditions=array()) {
}

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;
Expand Down

0 comments on commit 747f4a4

Please sign in to comment.