Skip to content

Commit 7f718b8

Browse files
committed
Move redundant and uncomprehensive calls to WP_Style_Engine_CSS_Rules_Store::remove_all_stores() to base tear_down method
1 parent 0519e6f commit 7f718b8

File tree

11 files changed

+4
-33
lines changed

11 files changed

+4
-33
lines changed

src/wp-includes/script-loader.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3232,7 +3232,8 @@ static function () use ( $style ) {
32323232
* }
32333233
*/
32343234
function wp_enqueue_stored_styles( $options = array() ) {
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.
3235+
// Note: Styles printed at wp_footer for classic themes may still end up in the head due to wp_load_block_styles_on_demand_in_classic_themes().
3236+
$is_block_theme = wp_is_block_theme();
32363237
$is_classic_theme = ! $is_block_theme;
32373238

32383239
/*

tests/phpunit/includes/abstract-testcase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ public function tear_down() {
218218
wp_set_current_user( 0 );
219219

220220
$this->reset_lazyload_queue();
221+
222+
WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
221223
}
222224

223225
/**

tests/phpunit/tests/block-supports/duotone.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@
99
*/
1010

1111
class Tests_Block_Supports_Duotone extends WP_UnitTestCase {
12-
/**
13-
* Cleans up CSS added to block-supports from duotone styles. We need to do this
14-
* in order to avoid impacting other tests.
15-
*/
16-
public static function wpTearDownAfterClass() {
17-
WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
18-
}
1912

2013
/**
2114
* Tests whether the duotone preset class is added to the block.

tests/phpunit/tests/block-supports/wpRenderBackgroundSupport.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public function set_up() {
4040
// Clear caches.
4141
wp_clean_themes_cache();
4242
unset( $GLOBALS['wp_themes'] );
43-
WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
4443
}
4544

4645
public function tear_down() {
@@ -53,7 +52,6 @@ public function tear_down() {
5352

5453
wp_clean_themes_cache();
5554
unset( $GLOBALS['wp_themes'] );
56-
WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
5755
unregister_block_type( $this->test_block_name );
5856
$this->test_block_name = null;
5957
parent::tear_down();

tests/phpunit/tests/block-supports/wpRenderDimensionsSupport.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public function set_up() {
4040
// Clear caches.
4141
wp_clean_themes_cache();
4242
unset( $GLOBALS['wp_themes'] );
43-
WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
4443
}
4544

4645
public function tear_down() {
@@ -53,7 +52,6 @@ public function tear_down() {
5352

5453
wp_clean_themes_cache();
5554
unset( $GLOBALS['wp_themes'] );
56-
WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
5755
unregister_block_type( $this->test_block_name );
5856
$this->test_block_name = null;
5957
parent::tear_down();

tests/phpunit/tests/block-supports/wpRenderElementsSupport.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class Tests_Block_Supports_WpRenderElementsSupport extends WP_UnitTestCase {
1212
private $test_block_name;
1313

1414
public function tear_down() {
15-
WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
1615
unregister_block_type( $this->test_block_name );
1716
$this->test_block_name = null;
1817
parent::tear_down();

tests/phpunit/tests/block-supports/wpRenderElementsSupportStyles.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class Tests_Block_Supports_WpRenderElementsSupportStyles extends WP_UnitTestCase
1212
private $test_block_name;
1313

1414
public function tear_down() {
15-
WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
1615
unregister_block_type( $this->test_block_name );
1716
$this->test_block_name = null;
1817
parent::tear_down();

tests/phpunit/tests/block-supports/wpRenderPositionSupport.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public function set_up() {
4141
// Clear caches.
4242
wp_clean_themes_cache();
4343
unset( $GLOBALS['wp_themes'] );
44-
WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
4544
}
4645

4746
public function tear_down() {
@@ -54,7 +53,6 @@ public function tear_down() {
5453

5554
wp_clean_themes_cache();
5655
unset( $GLOBALS['wp_themes'] );
57-
WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
5856
unregister_block_type( $this->test_block_name );
5957
$this->test_block_name = null;
6058
parent::tear_down();

tests/phpunit/tests/style-engine/styleEngine.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313
* Tests for registering, storing and generating styles.
1414
*/
1515
class Tests_wpStyleEngine extends WP_UnitTestCase {
16-
/**
17-
* Cleans up stores after each test.
18-
*/
19-
public function tear_down() {
20-
WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
21-
parent::tear_down();
22-
}
2316

2417
/**
2518
* Tests generating block styles and classnames based on various manifestations of the $block_styles argument.

tests/phpunit/tests/style-engine/wpStyleEngineCssRulesStore.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@
1515
* @coversDefaultClass WP_Style_Engine_CSS_Rules_Store
1616
*/
1717
class Tests_Style_Engine_wpStyleEngineCSSRulesStore extends WP_UnitTestCase {
18-
/**
19-
* Cleans up stores after each test.
20-
*/
21-
public function tear_down() {
22-
WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
23-
parent::tear_down();
24-
}
2518

2619
/**
2720
* Tests creating a new store on instantiation.

0 commit comments

Comments
 (0)