MDL-32323 minor phpunit related improvements and cleanup
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
* Exit codes:
|
||||
* 0 - success
|
||||
* 1 - general error
|
||||
* 130 - missing PHPUnit error
|
||||
* 130 - missing PHPUnit library error
|
||||
* 131 - configuration problem
|
||||
* 132 - install new test database
|
||||
* 133 - drop existing data before installing
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define('NO_OUTPUT_BUFFERING', true);
|
||||
|
||||
require(dirname(__FILE__) . '/../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$ADMIN->add('development', new admin_externalpage('toolphpunit', get_string('pluginname', 'tool_phpunit'), "$CFG->wwwroot/$CFG->admin/tool/phpunit/index.php"));
|
||||
$ADMIN->add('development', new admin_externalpage('toolphpunitwebrunner', get_string('pluginname', 'tool_phpunit'), "$CFG->wwwroot/$CFG->admin/tool/phpunit/webrunner.php",
|
||||
'moodle/site:config', true));
|
||||
if ($hassiteconfig) {
|
||||
$ADMIN->add('development', new admin_externalpage('toolphpunit', get_string('pluginname', 'tool_phpunit'), "$CFG->wwwroot/$CFG->admin/tool/phpunit/index.php"));
|
||||
$ADMIN->add('development', new admin_externalpage('toolphpunitwebrunner', get_string('pluginname', 'tool_phpunit'), "$CFG->wwwroot/$CFG->admin/tool/phpunit/webrunner.php",
|
||||
'moodle/site:config', true));
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2012030800; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2012030100; // Requires this Moodle version
|
||||
$plugin->version = 2012040500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2012040500; // Requires this Moodle version
|
||||
$plugin->component = 'tool_phpunit'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ require_once($CFG->libdir.'/adminlib.php');
|
||||
$path = optional_param('path', null, PARAM_PATH);
|
||||
$execute = optional_param('execute', 0, PARAM_BOOL);
|
||||
|
||||
|
||||
navigation_node::override_active_url(new moodle_url('/admin/tool/phpunit/index.php'));
|
||||
admin_externalpage_setup('toolphpunitwebrunner');
|
||||
|
||||
@@ -64,7 +63,6 @@ if ($code != 0) {
|
||||
}
|
||||
|
||||
if ($execute) {
|
||||
|
||||
require_sesskey();
|
||||
|
||||
chdir($CFG->dirroot);
|
||||
@@ -95,7 +93,6 @@ if ($execute) {
|
||||
|
||||
} else if ($code == 133) {
|
||||
tool_phpunit_header();
|
||||
ignore_user_abort(true);
|
||||
echo $OUTPUT->box_start('generalbox');
|
||||
echo '<pre>';
|
||||
echo "Reinitialising test database:\n\n";
|
||||
@@ -130,7 +127,6 @@ if ($execute) {
|
||||
echo $OUTPUT->box_start('generalbox');
|
||||
echo '<pre>';
|
||||
|
||||
chdir($CFG->dirroot);
|
||||
// use the dataroot file
|
||||
$configdir = "$CFG->phpunit_dataroot/phpunit/webrunner.xml";
|
||||
if (!file_exists($configdir)) {
|
||||
@@ -143,6 +139,7 @@ if ($execute) {
|
||||
// cleanup the path - this is tricky because we can not use quotes for escaping
|
||||
$path = escapeshellcmd($path);
|
||||
$path = str_replace('\*', '*', $path);
|
||||
chdir($CFG->dirroot);
|
||||
passthru("phpunit -c $configdir $path", $code);
|
||||
chdir($oldcwd);
|
||||
|
||||
@@ -173,7 +170,8 @@ die;
|
||||
//========================================
|
||||
|
||||
/**
|
||||
* Print headers and warning
|
||||
* Print headers and experimental warning
|
||||
* @return void
|
||||
*/
|
||||
function tool_phpunit_header() {
|
||||
global $OUTPUT;
|
||||
@@ -188,7 +186,7 @@ function tool_phpunit_header() {
|
||||
* @return void
|
||||
*/
|
||||
function tool_phpunit_problem($message) {
|
||||
global $OUTPUT, $PAGE;
|
||||
global $PAGE;
|
||||
if (!$PAGE->headerprinted) {
|
||||
tool_phpunit_header();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user