Changeset 61008 for trunk/tests/phpunit/tests/blocks/register.php
- Timestamp:
- 10/21/2025 05:59:38 AM (3 months ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/blocks/register.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/blocks/register.php
r59938 r61008 12 12 13 13 /** 14 * @var WP_Scripts|null 15 */ 16 protected $original_wp_scripts; 17 18 /** 19 * @var WP_Styles|null 20 */ 21 protected $original_wp_styles; 22 23 /** 14 24 * ID for a test post. 15 25 * … … 46 56 */ 47 57 public function render_stub() {} 58 59 /** 60 * Set up. 61 */ 62 public function set_up() { 63 parent::set_up(); 64 65 global $wp_scripts, $wp_styles; 66 $this->original_wp_scripts = $wp_scripts; 67 $this->original_wp_styles = $wp_styles; 68 $wp_scripts = null; 69 $wp_styles = null; 70 wp_scripts(); 71 wp_styles(); 72 } 48 73 49 74 /** … … 67 92 } 68 93 } 94 95 global $wp_scripts, $wp_styles; 96 $wp_scripts = $this->original_wp_scripts; 97 $wp_styles = $this->original_wp_styles; 69 98 70 99 parent::tear_down(); … … 1004 1033 ); 1005 1034 1035 // Register the styles not included in the metadata above. 1036 $metadata = array( 1037 'file' => DIR_TESTDATA . '/blocks/notice/block.json', 1038 'name' => 'tests/notice', 1039 'style' => 'file:./block.css', 1040 'viewStyle' => 'file:./block-view.css', 1041 ); 1042 $this->assertSame( 'tests-notice-style', register_block_style_handle( $metadata, 'style' ), 'Style handle is expected to be tests-notice-style' ); 1043 $this->assertSame( 'tests-notice-view-style', register_block_style_handle( $metadata, 'viewStyle' ), 'View style handle is expected to be tests-notice-view-style' ); 1044 $this->assertTrue( wp_style_is( 'tests-notice-style', 'registered' ), 'Expected "tests-notice-style" style to be registered.' ); 1045 $this->assertTrue( wp_style_is( 'tests-notice-view-style', 'registered' ), 'Expected "tests-notice-view-style" style to be registered.' ); 1046 1006 1047 $this->assertInstanceOf( 'WP_Block_Type', $result ); 1007 1048 $this->assertSame( 2, $result->api_version ); … … 1122 1163 $this->assertSame( 1123 1164 wp_normalize_path( realpath( DIR_TESTDATA . '/blocks/notice/block.css' ) ), 1124 wp_normalize_path( wp_styles()->get_data( 'tests- test-block-style', 'path' ) )1165 wp_normalize_path( wp_styles()->get_data( 'tests-notice-style', 'path' ) ) 1125 1166 ); 1126 1167 … … 1128 1169 $this->assertSame( 1129 1170 wp_normalize_path( realpath( DIR_TESTDATA . '/blocks/notice/block-view.css' ) ), 1130 wp_normalize_path( wp_styles()->get_data( 'tests- test-block-view-style', 'path' ) ),1171 wp_normalize_path( wp_styles()->get_data( 'tests-notice-view-style', 'path' ) ), 1131 1172 'viewStyle asset path is not correct' 1132 1173 );
Note: See TracChangeset
for help on using the changeset viewer.