MDL-43066 behat: Checking that the site is not already installed

This commit is contained in:
David Monllao
2013-12-02 14:11:33 +08:00
parent ea04def291
commit 812fa23e82
2 changed files with 9 additions and 0 deletions
+5
View File
@@ -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();
+4
View File
@@ -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;