From 95304962da1b54adfdc42d463310e50454ce4d5d Mon Sep 17 00:00:00 2001 From: Angelia Dela Cruz Date: Mon, 3 Nov 2025 15:22:10 +0800 Subject: [PATCH 1/2] MDL-87049 core: Behat to toggle campaign content banner display --- .../tests/behat/toggle_campaign_display.feature | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 admin/tests/behat/toggle_campaign_display.feature diff --git a/admin/tests/behat/toggle_campaign_display.feature b/admin/tests/behat/toggle_campaign_display.feature new file mode 100644 index 00000000000..c0cbb84def4 --- /dev/null +++ b/admin/tests/behat/toggle_campaign_display.feature @@ -0,0 +1,17 @@ +@core @core_admin +Feature: Toggle campaign banner visibility + In order to control the visibility of the campaign banner content + As an admin + I need to be able to disable the campaign banner display + + Scenario Outline: Admin can disable the campaign banner display + Given the following config values are set as admin: + | showcampaigncontent | | + And I log in as "admin" + When I navigate to "Notifications" in site administration + Then "//iframe[@id='campaign-content']" "xpath_element" exist + + Examples: + | showcampaigncontent | display | + | true | should | + | false | should not | From 280a604e4d5c6a347b49873e8b13dd694a0617e8 Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Thu, 6 Nov 2025 08:10:31 +0800 Subject: [PATCH 2/2] 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 fc6dfac2473..90d5307ecb7 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);