$d->dispose(); } } } if (!empty($tests)) { @ob_implicit_flush(true); while (@ob_end_flush()) { } foreach ($tests as $i => $database) { $dbinfo = $dbinfos[$i]; $UNITTEST->func_test_db = $database; // pass the db to the tests through global print_heading('Running tests on: ' . $dbinfo['name'], '', 3); // TODO: localise // Create the group of tests. $test = new AutoGroupTest(false, true); $test->addTestFile($CFG->libdir . '/dml/simpletest/testdml.php'); $test->addTestFile($CFG->libdir . '/ddl/simpletest/testddl.php'); // Make the reporter, which is what displays the results. $reporter = new ExHtmlReporter($showpasses); set_time_limit(300); $test->run($reporter); unset($UNITTEST->func_test_db); echo '<hr />'; } } // Print the form for adjusting options. print_simple_box_start('center', '70%'); echo '<form method="post" action="dbtest.php">'; echo '<div>'; print_heading("Run functional database tests");
/** * Run the autogroup_test_coverage tests using one externally defined code coverage reporter * allowing further process of coverage data once tests are over. Supports multiple * instrumentations (code coverage gathering sessions) to be executed. */ public function run_with_external_coverage($simpletestreporter, $covrecorder) { if (moodle_coverage_recorder::can_run_codecoverage() && $this->performcoverage) { $covrecorder->setIncludePaths($this->includecoverage); $covrecorder->setExcludePaths($this->excludecoverage); $covrecorder->start_instrumentation(); parent::run($simpletestreporter); $covrecorder->stop_instrumentation(); } else { // Testing without coverage parent::run($simpletestreporter); } }
admin_externalpage_setup('reportsimpletest', '', array('showpasses' => $showpasses, 'showsearch' => $showsearch)); $langfile = 'simpletest'; $unittest = true; global $UNITTEST; $UNITTEST = new object(); // Print the header. $strtitle = get_string('unittests', $langfile); if (!is_null($path)) { // Turn off xmlstrictheaders during the unit test run. $origxmlstrictheaders = !empty($CFG->xmlstrictheaders); $CFG->xmlstrictheaders = false; admin_externalpage_print_header(); $CFG->xmlstrictheaders = $origxmlstrictheaders; unset($origxmlstrictheaders); // Create the group of tests. $test = new AutoGroupTest($showsearch); // OU specific. We use the _nonproject folder for stuff we want to // keep in CVS, but which is not really relevant. It does no harm // to leave this here. $test->addIgnoreFolder($CFG->dirroot . '/_nonproject'); // Make the reporter, which is what displays the results. $reporter = new ExHtmlReporter($showpasses); if ($showsearch) { print_heading('Searching for test cases'); } flush(); // Work out what to test. if (substr($path, 0, 1) == '/') { $path = substr($path, 1); } $path = $CFG->dirroot . '/' . $path;