From a6d9be042dea52c270e3b0fb5bbade65f891b1c7 Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Thu, 6 Nov 2025 08:10:31 +0800 Subject: [PATCH] MDL-87049 behat: read showcampaigncontent setting when running behat --- admin/index.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/admin/index.php b/admin/index.php index 906a823985c..ecba9583787 100644 --- a/admin/index.php +++ b/admin/index.php @@ -916,8 +916,14 @@ if (empty($CFG->disabledevlibdirscheck) && (is_dir($CFG->dirroot.'/vendor') || i // Check if the site is being foced onto ssl. $overridetossl = !empty($CFG->overridetossl); -// Check if moodle campaign content setting is enabled or not. -$showcampaigncontent = !isset($CFG->showcampaigncontent) || $CFG->showcampaigncontent; +if (defined('BEHAT_SITE_RUNNING') && BEHAT_SITE_RUNNING) { + // We need to add this in order to be able to verify the showcampaigncontent setting behaviour during behat tests. + $showcampaigncontent = get_config('core', 'showcampaigncontent'); + $showcampaigncontent = $showcampaigncontent === 'true'; +} else { + // Check if moodle campaign content setting is enabled or not. + $showcampaigncontent = !isset($CFG->showcampaigncontent) || $CFG->showcampaigncontent; +} // Encourage admins to enable the user feedback feature if it is not enabled already. $showfeedbackencouragement = empty($CFG->enableuserfeedback);