Skip to content

Commit

Permalink
Merge branch 'MDL-37768_master' of git://github.com/dmonllao/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Feb 12, 2013
2 parents 2b8741a + b831d47 commit 5c70d65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/testing/classes/util.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static function is_test_site() {
*
* @return bool
*/
protected static function is_test_data_updated() {
public static function is_test_data_updated() {
global $CFG;

$framework = self::get_framework();
Expand Down
6 changes: 6 additions & 0 deletions lib/tests/behat/behat_hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public static function before_suite($event) {
define('BEHAT_RUNNING', 1);
define('CLI_SCRIPT', 1);

// With BEHAT_RUNNING we will be using $CFG->behat_* instead of $CFG->dataroot, $CFG->prefix and $CFG->wwwroot.
require_once(__DIR__ . '/../../../config.php');

// Now that we are MOODLE_INTERNAL.
Expand All @@ -88,6 +89,11 @@ public static function before_suite($event) {
throw new Exception($CFG->behat_wwwroot . ' is not available, ensure you started your PHP built-in server. More info in ' . behat_command::DOCS_URL . '#Running_tests');
}

// Prevents using outdated data, upgrade script would start and tests would fail.
if (!behat_util::is_test_data_updated()) {
$commandpath = 'php admin/tool/behat/cli/util.php';
throw new Exception('Your behat test site is outdated, please run ' . $commandpath . ' from your moodle dirroot to drop and install the behat test site again.');
}
// Avoid parallel tests execution, it continues when the previous lock is released.
test_lock::acquire('behat');
}
Expand Down

0 comments on commit 5c70d65

Please sign in to comment.