From 16a2a41273d90a179e1d2846aec7e995c05cd92d Mon Sep 17 00:00:00 2001 From: stronk7 Date: Tue, 23 Jun 2009 00:24:52 +0000 Subject: [PATCH] Fix one test failing depending of the debug/debugdisplay settings. --- lib/dml/simpletest/testdml.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/dml/simpletest/testdml.php b/lib/dml/simpletest/testdml.php index fa9fe15965..d0d4cfa656 100755 --- a/lib/dml/simpletest/testdml.php +++ b/lib/dml/simpletest/testdml.php @@ -12,6 +12,8 @@ class dml_test extends UnitTestCase { private $tables = array(); private $tdb; private $data; + public static $includecoverage = array('lib/dml'); + public static $excludecoverage = array('lib/dml/simpletest'); function setUp() { global $CFG, $DB, $UNITTEST; @@ -737,6 +739,7 @@ class dml_test extends UnitTestCase { } public function test_get_records_sql() { + global $CFG; $DB = $this->tdb; $dbman = $DB->get_manager(); @@ -759,13 +762,21 @@ class dml_test extends UnitTestCase { $this->assertEqual(1, reset($records)->id); $this->assertEqual(2, next($records)->id); + // Awful test, requires debug enabled and sent to browser. Let's do that and restore after test + $olddebug = $CFG->debug; // Save current debug settings + $olddisplay = $CFG->debugdisplay; + $CFG->debug = DEBUG_DEVELOPER; + $CFG->debugdisplay = true; ob_start(); // hide debug warning $records = $DB->get_records_sql("SELECT course AS id, course AS course FROM {".$tablename."}", null); - $debuginfo = ob_get_contents(); + $CFG->debug = $olddebug; // Restore original debug settings ob_end_clean(); + $CFG->debugdisplay = $olddisplay; + $debuginfo = ob_get_contents(); $this->assertEqual(3, count($records)); $this->assertFalse($debuginfo === ''); + print_object($debuginfo); } public function test_get_records_menu() { -- 2.39.5