From 499c8d894d2f47f5cbbfc4ff0e70bcdaf02bbc21 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Tue, 16 Jan 2018 13:21:47 +0800 Subject: [PATCH] MDL-61221 badges: Ignore site availabilty for behat Behat sites should not be available publically, and the check against the backpack API for site availablity can time out in some situations. We should be testing as though the site _is_ available, as this is the standard expectation. --- lib/badgeslib.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/badgeslib.php b/lib/badgeslib.php index 104d5e6b710..750d9851d01 100644 --- a/lib/badgeslib.php +++ b/lib/badgeslib.php @@ -1148,6 +1148,12 @@ function badges_download($userid) { * @return string Code of backpack accessibility status. */ function badges_check_backpack_accessibility() { + if (defined('BEHAT_SITE_RUNNING') && BEHAT_SITE_RUNNING) { + // For behat sites, do not poll the remote badge site. + // Behat sites should not be available, but we should pretend as though they are. + return 'available'; + } + global $CFG; include_once $CFG->libdir . '/filelib.php';