moodle-tool_heartbeat icon indicating copy to clipboard operation
moodle-tool_heartbeat copied to clipboard

Cron web check fails behat for other plugins

Open sharpchi opened this issue 3 months ago • 0 comments

I have heartbeat installed in my dev environment. When I run behat tests for other plugins (unless the behatDB is a clean install) I get the following error:

    │
    ╳  debugging() message/s found:
    ╳  
    ╳  HEARTBEAT doing web ping
    ╳  line 177 of /admin/tool/heartbeat/classes/check/cachecheck.php: call to debugging()
    ╳  line 29 of /admin/tool/heartbeat/lib.php: call to tool_heartbeat\check\cachecheck::ping()
    ╳  line 1372 of /lib/outputrenderers.php: call to tool_heartbeat_before_http_headers()
    ╳  line 116 of /index.php: call to core_renderer->header()
    ╳   (Exception)
    │

And this causes my behat tests to fail.

I could uninstall heartbeat on my dev install, but I do like to have all the plugins installed locally so I can identify any cross plugin issues.

Is there any way to stop this happening when running Behat? Perhaps add a check for BEHAT_RUNNING?

function tool_heartbeat_before_http_headers() {
    if (BEHAT_SITE_RUNNING) {
        return;
    }
    if (class_exists('\core\check\manager')) {
        \tool_heartbeat\check\cachecheck::ping('web');
    }
}

Thanks

sharpchi avatar Mar 22 '24 10:03 sharpchi