echo '<ul>'; foreach ($dbinfos as $i => $dbinfo) { $name = $dbinfo['name']; if ($dbinfo['installed']) { if (!$dbinfo['configured']) { $name = "{$name} (misconfigured)"; // TODO: localise } echo '<li>' . html_writer::checkbox('selected[' . $i . ']', 1, intval(!empty($selected[$i])), $name) . '</li>'; } else { echo '<li>' . "{$name}: driver not installed" . '</li>'; // TODO: localise } } echo '</ul>'; echo '<p>External databases are configured in config.php, add lines:</p> <pre> $CFG->func_test_db_1 = array("native", "pgsql", "localhost", "moodleuser", "password", "moodle", "test", null); $CFG->func_test_db_2 = array("native", "mssql", "localhost", "moodleuser", "password", "moodle", "test", null); </pre> <p>where order of parameters is: dblibrary, dbtype, dbhost, dbuser, dbpass, dbname, prefix, dboptions</p>'; echo '<p><input type="submit" value="' . get_string('runtests', 'tool_unittest') . '" /></p>'; echo '</div>'; echo '</form>'; echo $OUTPUT->box_end(); // Print link to latest code coverage for this report type if (!data_submitted() || !$codecoverage) { moodle_coverage_reporter::print_link_to_latest('dbtest'); } // Footer. echo $OUTPUT->footer();
/** * Run the autogroup_test_coverage using one internally defined code coverage reporter * automatically generating the coverage report. Only supports one instrumentation * to be executed and reported. */ public function run($simpletestreporter) { global $CFG; if (moodle_coverage_recorder::can_run_codecoverage() && $this->performcoverage) { // Testing with coverage $covreporter = new moodle_coverage_reporter($this->coveragename, $this->coveragedir); $covrecorder = new moodle_coverage_recorder($covreporter); $covrecorder->setIncludePaths($this->includecoverage); $covrecorder->setExcludePaths($this->excludecoverage); $covrecorder->start_instrumentation(); parent::run($simpletestreporter); $covrecorder->stop_instrumentation(); set_time_limit(60 * 10); // it may take a long time to generate the report $covrecorder->generate_report(); moodle_coverage_reporter::print_summary_info(basename($this->coveragedir)); } else { // Testing without coverage parent::run($simpletestreporter); } }