Skip to content

Commit f8e21fd

Browse files
committed
Fix PHPUnit tests after integrating the kill switch for builtin snippets
1 parent c5c3314 commit f8e21fd

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/snippets_test.php

+13-2
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,30 @@ public function test_fetch_enabled_snippets_scss(): void {
127127

128128
$this->resetAfterTest();
129129

130+
// Get the SCSS content of all enabled snippets.
130131
$scss = snippets::get_enabled_snippet_scss();
131132

132-
// No snippets are enabled by default, so the scss should be empty.
133+
// Builtin snippets are disabled by default as a whole, so the scss should be empty.
133134
$this->assertEquals('', $scss);
134135

135-
// Enable a snippet directly via the DB.
136+
// Enable builtin snippets directly via the DB.
137+
set_config('enablebuiltinsnippets', 'yes', 'theme_boost_union');
138+
139+
// Get the SCSS content of all enabled snippets again.
140+
$scss = snippets::get_enabled_snippet_scss();
141+
142+
// No particular builtin snippet is enabled by default, so the scss should still be empty.
143+
$this->assertEquals('', $scss);
144+
145+
// Enable a builtin snippet directly via the DB.
136146
$snippet = $DB->get_record(
137147
'theme_boost_union_snippets',
138148
['source' => 'theme_boost_union', 'path' => 'visual-depth.scss']
139149
);
140150
$snippet->enabled = 1;
141151
$DB->update_record('theme_boost_union_snippets', $snippet);
142152

153+
// Get the SCSS content of all enabled snippets again.
143154
$scss = snippets::get_enabled_snippet_scss();
144155

145156
// Verify that the Snippets SCSS content is now queried.

0 commit comments

Comments
 (0)