flush(); // Work out what to test. if (substr($path, 0, 1) == '/') { $path = substr($path, 1); } $path = $CFG->dirroot . '/' . $path; if (substr($path, -1) == '/') { $path = substr($path, 0, -1); } $displaypath = substr($path, strlen($CFG->dirroot) + 1); $ok = true; if (is_file($path)) { $test->addTestFile($path); } else { if (is_dir($path)) { $test->findTestFiles($path); } else { print_simple_box(get_string('pathdoesnotexist', $langfile, $path), '', '', '', '', 'errorbox'); $ok = false; } } // If we have something to test, do it. if ($ok) { if ($path == $CFG->dirroot) { $title = get_string('moodleunittests', $langfile, get_string('all', $langfile)); } else { $title = get_string('moodleunittests', $langfile, $displaypath); } print_heading($title); $test->run($reporter); }