Skip to content

Commit 49520fa

Browse files
committed
Add test case in classic theme when output buffering disabled
1 parent 2579e53 commit 49520fa

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

tests/phpunit/tests/template.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ public function test_wp_start_template_enhancement_output_buffer_for_json(): voi
894894
}
895895

896896
/**
897-
* Tests that wp_always_load_block_styles_on_demand does not add filters for block themes.
897+
* Tests that wp_load_block_styles_on_demand_in_classic_themes() does not add filters for block themes.
898898
*
899899
* @ticket 64099
900900
* @covers ::wp_load_block_styles_on_demand_in_classic_themes
@@ -909,6 +909,23 @@ public function test_wp_load_block_styles_on_demand_in_classic_themes_in_block_t
909909
$this->assertFalse( has_action( 'wp_template_enhancement_output_buffer_started', 'wp_hoist_late_printed_styles' ), 'Expect wp_template_enhancement_output_buffer_started action NOT to be added for block themes.' );
910910
}
911911

912+
/**
913+
* Tests that wp_load_block_styles_on_demand_in_classic_themes() does not add filters for classic themes then output buffering is blocked.
914+
*
915+
* @ticket 64099
916+
* @covers ::wp_load_block_styles_on_demand_in_classic_themes
917+
*/
918+
public function test_wp_load_block_styles_on_demand_in_classic_themes_in_classic_theme_but_output_buffering_blocked(): void {
919+
add_filter( 'wp_should_output_buffer_template_for_enhancement', '__return_false' );
920+
switch_theme( 'default' );
921+
922+
wp_load_block_styles_on_demand_in_classic_themes();
923+
924+
$this->assertFalse( has_filter( 'should_load_separate_core_block_assets' ), 'Expect should_load_separate_core_block_assets filter NOT to be added for block themes.' );
925+
$this->assertFalse( has_filter( 'should_load_block_assets_on_demand', '__return_true' ), 'Expect should_load_block_assets_on_demand filter NOT to be added for block themes.' );
926+
$this->assertFalse( has_action( 'wp_template_enhancement_output_buffer_started', 'wp_hoist_late_printed_styles' ), 'Expect wp_template_enhancement_output_buffer_started action NOT to be added for block themes.' );
927+
}
928+
912929
/**
913930
* Tests that wp_always_load_block_styles_on_demand adds the expected filters for classic themes.
914931
*
@@ -929,7 +946,7 @@ public function test_wp_load_block_styles_on_demand_in_classic_themes_in_classic
929946
}
930947

931948
/**
932-
* Tests that wp_hoist_late_printed_styles adds a placeholder for delayed CSS, then removes it and adds all CSS to the head including late enqueued styles.
949+
* Tests that wp_hoist_late_printed_styles() adds a placeholder for delayed CSS, then removes it and adds all CSS to the head including late enqueued styles.
933950
*
934951
* @ticket 64099
935952
* @covers ::wp_hoist_late_printed_styles

0 commit comments

Comments
 (0)