@@ -1645,9 +1645,6 @@ function (): void {
16451645 * @dataProvider data_wp_hoist_late_printed_styles
16461646 */
16471647 public function test_wp_hoist_late_printed_styles ( ?Closure $ set_up , int $ inline_size_limit , array $ expected_styles ): void {
1648- $ GLOBALS ['debug_on_demand_block_style ' ] = true ; // TODO: Remove.
1649- error_log ( "\n##BEGIN DEBUG #################################### \n" );
1650-
16511648 switch_theme ( 'default ' );
16521649 global $ wp_styles ;
16531650 $ wp_styles = null ;
@@ -1677,47 +1674,10 @@ static function () {
16771674 register_core_block_style_handles ();
16781675 $ this ->assertTrue ( WP_Block_Type_Registry::get_instance ()->is_registered ( 'core/separator ' ), 'Expected the core/separator block to be registered. ' );
16791676
1680- // Ensure
1677+ // Ensure stylesheet files exist on the filesystem since a build may not have been done.
16811678 $ this ->ensure_style_asset_file_created ( 'wp-block-library ' , 'css/dist/block-library/style.css ' );
1682- // $handle = 'wp-block-library';
1683- // $this->assertTrue( wp_style_is( $handle, 'registered' ), 'Expected the wp-block-library style to be registered.' );
1684- // $dependency = wp_styles()->query( $handle );
1685- // $relative_path = 'css/dist/block-library/style.css';
1686- // error_log( __FILE__ . ':' . __LINE__ . ' $dependency->src === ' . $dependency->src );
1687- // $dependency->src = includes_url( $relative_path );
1688- // $path = ABSPATH . WPINC . '/blocks/separator/style.css';
1689- // if ( ! file_exists( $path ) ) {
1690- // mkdir( dirname( $path ), 0777, true );
1691- // error_log( __FILE__ . ':' . __LINE__ . ' FILE DOES NOT EXIST: ' . $path );
1692- // file_put_contents( $path, '/* The separator CSS */' );
1693- // } else {
1694- // error_log( __FILE__ . ':' . __LINE__ . ' FILE DOES EXIST: ' . $path );
1695- // }
1696- // wp_style_add_data( $handle, 'path', $path );
1697-
16981679 if ( wp_should_load_separate_core_block_assets () ) {
16991680 $ this ->ensure_style_asset_file_created ( 'wp-block-separator ' , 'blocks/separator/style.css ' );
1700-
1701- // $handle = 'wp-block-separator';
1702- // $this->assertTrue( wp_style_is( $handle, 'registered' ), 'Expected the wp-block-separator style to be registered.' );
1703- // $dependency = wp_styles()->query( $handle );
1704- // error_log( __FILE__ . ':' . __LINE__ . ' $dependency->src === ' . $dependency->src );
1705- // $relative_path = 'blocks/separator/style.css';
1706- // $dependency->src = includes_url( $relative_path );
1707- // $path = ABSPATH . WPINC . '/' . $relative_path;
1708- // if ( ! file_exists( $path ) ) {
1709- // mkdir( dirname( $path ), 0777, true );
1710- // error_log( __FILE__ . ':' . __LINE__ . ' FILE DOES NOT EXIST: ' . $path );
1711- // file_put_contents( $path, '/* The separator CSS */' );
1712- // } else {
1713- // error_log( __FILE__ . ':' . __LINE__ . ' FILE DOES EXIST: ' . $path );
1714- // }
1715- // wp_style_add_data( $handle, 'path', $path );
1716-
1717- $ handle = 'wp-block-separator ' ;
1718- $ done = wp_styles ()->done ;
1719- error_log ( __FILE__ . ': ' . __LINE__ . ": wp_print_styles( $ handle): " . get_echo ( 'wp_print_styles ' , array ( $ handle ) ) );
1720- wp_styles ()->done = $ done ;
17211681 }
17221682
17231683 $ this ->assertFalse ( wp_is_block_theme (), 'Test is not relevant to block themes (only classic themes). ' );
@@ -1754,9 +1714,6 @@ static function () {
17541714 'the_content ' ,
17551715 '<!-- wp:separator --><hr class="wp-block-separator has-alpha-channel-opacity"/><!-- /wp:separator --> '
17561716 );
1757- if ( ! empty ( $ GLOBALS ['debug_on_demand_block_style ' ] ) ) {
1758- error_log ( __FILE__ . ': ' . __LINE__ . ' wp_styles()->queue: ' . json_encode ( wp_styles ()->queue ) );
1759- }
17601717
17611718 // Simulate footer scripts.
17621719 $ footer_output = get_echo ( 'wp_footer ' );
@@ -1802,9 +1759,6 @@ static function () {
18021759 $ found_subset_styles ,
18031760 'Expected the same styles. Snapshot: ' . self ::get_array_snapshot_export ( $ found_styles )
18041761 );
1805-
1806- unset( $ GLOBALS ['debug_on_demand_block_style ' ] ); // TODO: Remove.
1807- error_log ( "\n##END DEBUG #################################### \n" ); // TODO: Remove.
18081762 }
18091763
18101764 /**
@@ -1820,19 +1774,15 @@ static function () {
18201774 */
18211775 private function ensure_style_asset_file_created ( string $ handle , string $ relative_path ) {
18221776 $ this ->assertTrue ( wp_style_is ( $ handle , 'registered ' ), 'Expected the wp-block-separator style to be registered. ' );
1823- $ dependency = wp_styles ()->query ( $ handle );
1824- error_log ( __FILE__ . ': ' . __LINE__ . ' $dependency->src === ' . $ dependency ->src );
1777+ $ dependency = wp_styles ()->query ( $ handle );
18251778 $ dependency ->src = includes_url ( $ relative_path );
18261779 $ path = ABSPATH . WPINC . '/ ' . $ relative_path ;
18271780 if ( ! file_exists ( $ path ) ) {
18281781 $ dir = dirname ( $ path );
18291782 if ( ! file_exists ( $ dir ) ) {
18301783 mkdir ( $ dir , 0777 , true );
18311784 }
1832- error_log ( __FILE__ . ': ' . __LINE__ . ' FILE DOES NOT EXIST: ' . $ path );
18331785 file_put_contents ( $ path , "/* CSS for $ handle */ " );
1834- } else {
1835- error_log ( __FILE__ . ': ' . __LINE__ . ' FILE DOES EXIST: ' . $ path );
18361786 }
18371787 wp_style_add_data ( $ handle , 'path ' , $ path );
18381788 }
0 commit comments