From 351f4bc248050a163c694f741cd952c59dcc8a8a Mon Sep 17 00:00:00 2001
From: Petr Skoda
Date: Tue, 10 Apr 2012 14:38:50 +0200
Subject: [PATCH] MDL-32323 allow specification of test class in webrunner and
add some explanation of parameters
---
admin/tool/phpunit/webrunner.php | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/admin/tool/phpunit/webrunner.php b/admin/tool/phpunit/webrunner.php
index f7bfddc5e33..ef5168534d3 100644
--- a/admin/tool/phpunit/webrunner.php
+++ b/admin/tool/phpunit/webrunner.php
@@ -27,8 +27,9 @@ define('NO_OUTPUT_BUFFERING', true);
require(dirname(__FILE__) . '/../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
-$path = optional_param('path', null, PARAM_PATH);
-$execute = optional_param('execute', 0, PARAM_BOOL);
+$testpath = optional_param('testpath', '', PARAM_PATH);
+$testclass = optional_param('testclass', '', PARAM_ALPHANUMEXT);
+$execute = optional_param('execute', 0, PARAM_BOOL);
navigation_node::override_active_url(new moodle_url('/admin/tool/phpunit/index.php'));
admin_externalpage_setup('toolphpunitwebrunner');
@@ -82,7 +83,7 @@ if ($execute) {
tool_phpunit_problem('Can not initialize database');
}
$CFG->debug = 0; // no pesky redirect warning, we really want to redirect
- redirect(new moodle_url($PAGE->url, array('execute'=>1, 'path'=>$path, 'sesskey'=>sesskey())), 'Reloading page');
+ redirect(new moodle_url($PAGE->url, array('execute'=>1, 'tespath'=>$testpath, 'testclass'=>$testclass, 'sesskey'=>sesskey())), 'Reloading page');
echo $OUTPUT->footer();
die();
@@ -103,7 +104,7 @@ if ($execute) {
tool_phpunit_problem('Can not initialize database');
}
$CFG->debug = 0; // no pesky redirect warning, we really want to redirect
- redirect(new moodle_url($PAGE->url, array('execute'=>1, 'path'=>$path, 'sesskey'=>sesskey())), 'Reloading page');
+ redirect(new moodle_url($PAGE->url, array('execute'=>1, 'tespath'=>$testpath, 'testclass'=>$testclass, 'sesskey'=>sesskey())), 'Reloading page');
die();
} else {
@@ -134,7 +135,7 @@ if ($execute) {
// no cleanup of path - this is tricky because we can not use escapeshellarg and friends for escaping,
// this is from admin user so PARAM_PATH must be enough
chdir($CFG->dirroot);
- passthru("php $CFG->admin/tool/phpunit/cli/util.php --run -c $configdir $path", $code);
+ passthru("php $CFG->admin/tool/phpunit/cli/util.php --run -c $configdir $testclass $testpath", $code);
chdir($oldcwd);
echo '';
@@ -147,8 +148,11 @@ if ($execute) {
echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter');
echo '
';
+echo ' ';
+echo ' (first class in file if empty)';
echo '';
echo '';
echo '';