mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-32323 improve self-diagnostic messages
This commit is contained in:
parent
8b5413ccf2
commit
219d1a4e72
@ -33,6 +33,9 @@
|
||||
*/
|
||||
function phpunit_bootstrap_error($errorcode, $text = '') {
|
||||
switch ($errorcode) {
|
||||
case 0:
|
||||
// this is not an error, just print information and exit
|
||||
break;
|
||||
case 1:
|
||||
$text = 'Error: '.$text;
|
||||
break;
|
||||
|
@ -564,7 +564,7 @@ class phpunit_util {
|
||||
global $DB, $CFG;
|
||||
|
||||
if (!self::is_test_site()) {
|
||||
cli_error('Can not drop non-test sites!!', 131);
|
||||
phpunit_bootstrap_error(131, 'Can not drop non-test site!!');
|
||||
}
|
||||
|
||||
// purge dataroot
|
||||
@ -609,11 +609,16 @@ class phpunit_util {
|
||||
global $DB, $CFG;
|
||||
|
||||
if (!self::is_test_site()) {
|
||||
cli_error('Can not install non-test sites!!', 131);
|
||||
phpunit_bootstrap_error(131, 'Can not install on non-test site!!');
|
||||
}
|
||||
|
||||
if ($DB->get_tables()) {
|
||||
cli_error('Database tables already installed, drop the site first.', 133);
|
||||
list($errorcode, $message) = phpunit_util::testing_ready_problem();
|
||||
if ($errorcode) {
|
||||
phpunit_bootstrap_error(133, 'Database tables already installed, drop the site first.');
|
||||
} else {
|
||||
phpunit_bootstrap_error(0, 'Test database is already initialised');
|
||||
}
|
||||
}
|
||||
|
||||
$options = array();
|
||||
|
Loading…
x
Reference in New Issue
Block a user