Skip to content

Commit 0519e6f

Browse files
committed
Fix test_should_enqueue_stored_styles by cleaning up global state
1 parent 86836a7 commit 0519e6f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/wp-includes/script-loader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3232,7 +3232,7 @@ static function () use ( $style ) {
32323232
* }
32333233
*/
32343234
function wp_enqueue_stored_styles( $options = array() ) {
3235-
$is_block_theme = wp_is_block_theme();
3235+
$is_block_theme = wp_is_block_theme(); // TODO: Shouldn't this rather check wp_should_load_block_assets_on_demand()? It should be something like $is_printing_styles_late.
32363236
$is_classic_theme = ! $is_block_theme;
32373237

32383238
/*

tests/phpunit/tests/theme/wpEnqueueStoredStyles.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ class Tests_Themes_WpEnqueueStoredStyles extends WP_Theme_UnitTestCase {
2424
public function set_up() {
2525
parent::set_up();
2626

27+
// TODO: This shouldn't be needed here. It should be done as part of the test that added the store.
28+
WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
29+
2730
global $wp_scripts, $wp_styles;
2831
$this->original_wp_scripts = $wp_scripts;
2932
$this->original_wp_styles = $wp_styles;
@@ -45,6 +48,9 @@ public function tear_down() {
4548
* Tests that stored CSS is enqueued.
4649
*
4750
* @ticket 56467
51+
*
52+
* @covers ::wp_style_engine_get_stylesheet_from_css_rules
53+
* @covers ::wp_enqueue_stored_styles
4854
*/
4955
public function test_should_enqueue_stored_styles() {
5056
$core_styles_to_enqueue = array(

0 commit comments

Comments
 (0)