MDL-32323 experimental web UI for execution of PHPUnit tests
It is not localised intentionally because only developers should use it…
This commit is contained in:
@@ -20,9 +20,11 @@
|
||||
* Exit codes:
|
||||
* 0 - success
|
||||
* 1 - general error
|
||||
* 130 - coding error
|
||||
* 130 - missing PHPUnit error
|
||||
* 131 - configuration problem
|
||||
* 132 - install new test database
|
||||
* 133 - drop existing data before installing
|
||||
* 134 - can not create main phpunit.xml
|
||||
*
|
||||
* @package tool_phpunit
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
@@ -31,10 +33,11 @@
|
||||
|
||||
define('PHPUNIT_UTIL', true);
|
||||
|
||||
require_once(__DIR__ . '/../../../../lib/phpunit/bootstraplib.php');
|
||||
|
||||
// verify PHPUnit installation
|
||||
if (!@include_once('PHPUnit/Autoload.php')) {
|
||||
fwrite(STDERR, "Can not load PHPUnit PEAR library, is it installed?\n");
|
||||
exit(1);
|
||||
phpunit_bootstrap_error(130);
|
||||
}
|
||||
|
||||
require(__DIR__ . '/../../../../lib/phpunit/bootstrap.php');
|
||||
@@ -51,6 +54,7 @@ list($options, $unrecognized) = cli_get_params(
|
||||
'drop' => false,
|
||||
'install' => false,
|
||||
'buildconfig' => false,
|
||||
'diag' => false,
|
||||
'help' => false,
|
||||
),
|
||||
array(
|
||||
@@ -63,17 +67,19 @@ if ($unrecognized) {
|
||||
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
|
||||
}
|
||||
|
||||
$diag = $options['diag'];
|
||||
$drop = $options['drop'];
|
||||
$install = $options['install'];
|
||||
$buildconfig = $options['buildconfig'];
|
||||
|
||||
if ($options['help'] or (!$drop and !$install and !$buildconfig)) {
|
||||
if ($options['help'] or (!$drop and !$install and !$buildconfig and !$diag)) {
|
||||
$help = "Various PHPUnit utility functions
|
||||
|
||||
Options:
|
||||
--drop Drop database and dataroot
|
||||
--install Install database
|
||||
--buildconfig Build /phpunit.xml from /phpunit.xml.dist that includes suites for all plugins and core
|
||||
--diag Diagnose installation and return error code only
|
||||
|
||||
-h, --help Print out this help
|
||||
|
||||
@@ -81,13 +87,24 @@ Example:
|
||||
\$/usr/bin/php lib/phpunit/tool.php
|
||||
";
|
||||
echo $help;
|
||||
die;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ($buildconfig) {
|
||||
phpunit_util::build_config_file();
|
||||
if ($diag) {
|
||||
list($errorcode, $message) = phpunit_util::testing_ready_problem();
|
||||
if ($errorcode) {
|
||||
phpunit_bootstrap_error($errorcode, $message);
|
||||
}
|
||||
exit(0);
|
||||
|
||||
} else if ($buildconfig) {
|
||||
if (phpunit_util::build_config_file()) {
|
||||
exit(0);
|
||||
} else {
|
||||
phpunit_bootstrap_error(134);
|
||||
}
|
||||
|
||||
|
||||
} else if ($drop) {
|
||||
phpunit_util::drop_site();
|
||||
// note: we must stop here because $CFG is messed up and we can not reinstall, sorry
|
||||
|
||||
Reference in New Issue
Block a user