From 7f935ca08d77b616b03d5c73d308a76d3fb798bb Mon Sep 17 00:00:00 2001 From: waleedhassan Date: Fri, 5 Jul 2024 09:26:40 +0100 Subject: [PATCH] WR #432782: Moodle 4.4 fixing heartbeat causing behat to fail For some reason a debugging message was causing all the behat tests to fail when heartbeat was running on the site so I added a check to not run the debugging message when a behat test is running. --- classes/check/cachecheck.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classes/check/cachecheck.php b/classes/check/cachecheck.php index 56ea306..aa868d3 100644 --- a/classes/check/cachecheck.php +++ b/classes/check/cachecheck.php @@ -180,7 +180,10 @@ public static function ping($type) { // This should help detect any cache replication delays. $readbackvalue = self::get_cache_ping_value($type); - debugging("\nHEARTBEAT doing {$type} ping\n", DEBUG_DEVELOPER); + // Checking if behat site is running. + if (!(defined('BEHAT_SITE_RUNNING') && BEHAT_SITE_RUNNING)) { + debugging("\nHEARTBEAT doing {$type} ping\n", DEBUG_DEVELOPER); + } if (get_config('tool_heartbeat', 'shouldlogcacheping')) { lib::record_cache_pinged($currentcache, $currentdb, $time, $readbackvalue, $type);