Skip to content

Commit

Permalink
Fix PHPUnit tests after integrating the kill switch for builtin snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
abias committed Nov 6, 2024
1 parent c5c3314 commit f8e21fd
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tests/snippets_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,30 @@ public function test_fetch_enabled_snippets_scss(): void {

$this->resetAfterTest();

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

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

// Enable a snippet directly via the DB.
// Enable builtin snippets directly via the DB.
set_config('enablebuiltinsnippets', 'yes', 'theme_boost_union');

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

// No particular builtin snippet is enabled by default, so the scss should still be empty.
$this->assertEquals('', $scss);

// Enable a builtin snippet directly via the DB.
$snippet = $DB->get_record(
'theme_boost_union_snippets',
['source' => 'theme_boost_union', 'path' => 'visual-depth.scss']
);
$snippet->enabled = 1;
$DB->update_record('theme_boost_union_snippets', $snippet);

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

// Verify that the Snippets SCSS content is now queried.
Expand Down

0 comments on commit f8e21fd

Please sign in to comment.