MDL-43066 behat: Checking that the site is not already installed
This commit is contained in:
@@ -69,6 +69,11 @@ class behat_util extends testing_util {
|
||||
throw new coding_exception('This method can be only used by Behat CLI tool');
|
||||
}
|
||||
|
||||
$tables = $DB->get_tables(false);
|
||||
if (!empty($tables)) {
|
||||
behat_error(BEHAT_EXITCODE_INSTALLED);
|
||||
}
|
||||
|
||||
// New dataroot.
|
||||
self::reset_dataroot();
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ define('BEHAT_EXITCODE_PERMISSIONS', 252);
|
||||
define('BEHAT_EXITCODE_REINSTALL', 253);
|
||||
define('BEHAT_EXITCODE_INSTALL', 254);
|
||||
define('BEHAT_EXITCODE_COMPOSER', 255);
|
||||
define('BEHAT_EXITCODE_INSTALLED', 256);
|
||||
|
||||
/**
|
||||
* Exits with an error code
|
||||
@@ -62,6 +63,9 @@ function behat_error($errorcode, $text = '') {
|
||||
$path = testing_cli_argument_path('/admin/tool/behat/cli/init.php');
|
||||
$text = "Install Behat before enabling it, use:\n php ".$path;
|
||||
break;
|
||||
case BEHAT_EXITCODE_INSTALLED:
|
||||
$text = "The Behat site is already installed";
|
||||
break;
|
||||
default:
|
||||
$text = 'Unknown error ' . $errorcode . ' ' . $text;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user