Fix one test failing depending of the debug/debugdisplay settings.

This commit is contained in:
stronk7
2009-06-23 00:24:52 +00:00
parent feb828819e
commit 16a2a41273
+12 -1
View File
@@ -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() {