Changeset 53153 for trunk/tests/phpunit/tests/block-supports/typography.php
- Timestamp:
- 04/12/2022 09:38:18 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/block-supports/typography.php
r53128 r53153 5 5 class Tests_Block_Supports_Typography extends WP_UnitTestCase { 6 6 /** 7 * @var string|null 8 */ 9 private $test_block_name; 10 11 function set_up() { 12 parent::set_up(); 13 $this->test_block_name = null; 14 } 15 16 function tear_down() { 17 unregister_block_type( $this->test_block_name ); 18 $this->test_block_name = null; 19 parent::set_up(); 20 } 21 22 /** 7 23 * @ticket 54337 8 24 * … … 10 26 */ 11 27 function test_font_size_slug_with_numbers_is_kebab_cased_properly() { 12 register_block_type( 13 'test/font-size-slug-with-numbers', 28 $this->test_block_name = 'test/font-size-slug-with-numbers'; 29 register_block_type( 30 $this->test_block_name, 14 31 array( 15 32 'api_version' => 2, … … 27 44 ); 28 45 $registry = WP_Block_Type_Registry::get_instance(); 29 $block_type = $registry->get_registered( 'test/font-size-slug-with-numbers');46 $block_type = $registry->get_registered( $this->test_block_name ); 30 47 31 48 $block_atts = array( 'fontSize' => 'h1' ); … … 35 52 36 53 $this->assertSame( $expected, $actual ); 37 unregister_block_type( 'test/font-size-slug-with-numbers' );38 54 } 39 55 /** … … 43 59 */ 44 60 function test_font_family_with_legacy_inline_styles_using_a_value() { 45 $ block_name = 'test/font-family-with-inline-styles-using-value';46 register_block_type( 47 $ block_name,61 $this->test_block_name = 'test/font-family-with-inline-styles-using-value'; 62 register_block_type( 63 $this->test_block_name, 48 64 array( 49 65 'api_version' => 2, … … 61 77 ); 62 78 $registry = WP_Block_Type_Registry::get_instance(); 63 $block_type = $registry->get_registered( $ block_name );79 $block_type = $registry->get_registered( $this->test_block_name ); 64 80 $block_atts = array( 'style' => array( 'typography' => array( 'fontFamily' => 'serif' ) ) ); 65 81 … … 68 84 69 85 $this->assertSame( $expected, $actual ); 70 unregister_block_type( $block_name );71 86 } 72 87 … … 77 92 */ 78 93 function test_typography_with_skipped_serialization_block_supports() { 79 $ block_name = 'test/typography-with-skipped-serialization-block-supports';80 register_block_type( 81 $ block_name,94 $this->test_block_name = 'test/typography-with-skipped-serialization-block-supports'; 95 register_block_type( 96 $this->test_block_name, 82 97 array( 83 98 'api_version' => 2, … … 99 114 ); 100 115 $registry = WP_Block_Type_Registry::get_instance(); 101 $block_type = $registry->get_registered( $ block_name );116 $block_type = $registry->get_registered( $this->test_block_name ); 102 117 $block_atts = array( 103 118 'style' => array( … … 115 130 116 131 $this->assertSame( $expected, $actual ); 117 unregister_block_type( $block_name );118 132 } 119 133 … … 124 138 */ 125 139 function test_letter_spacing_with_individual_skipped_serialization_block_supports() { 126 $ block_name = 'test/letter-spacing-with-individua-skipped-serialization-block-supports';127 register_block_type( 128 $ block_name,140 $this->test_block_name = 'test/letter-spacing-with-individua-skipped-serialization-block-supports'; 141 register_block_type( 142 $this->test_block_name, 129 143 array( 130 144 'api_version' => 2, … … 145 159 ); 146 160 $registry = WP_Block_Type_Registry::get_instance(); 147 $block_type = $registry->get_registered( $ block_name );161 $block_type = $registry->get_registered( $this->test_block_name ); 148 162 $block_atts = array( 'style' => array( 'typography' => array( 'letterSpacing' => '22px' ) ) ); 149 163 … … 152 166 153 167 $this->assertSame( $expected, $actual ); 154 unregister_block_type( $block_name );155 168 } 156 169 /** … … 160 173 */ 161 174 function test_font_family_with_legacy_inline_styles_using_a_css_var() { 162 $ block_name = 'test/font-family-with-inline-styles-using-css-var';163 register_block_type( 164 $ block_name,175 $this->test_block_name = 'test/font-family-with-inline-styles-using-css-var'; 176 register_block_type( 177 $this->test_block_name, 165 178 array( 166 179 'api_version' => 2, … … 178 191 ); 179 192 $registry = WP_Block_Type_Registry::get_instance(); 180 $block_type = $registry->get_registered( $ block_name );193 $block_type = $registry->get_registered( $this->test_block_name ); 181 194 $block_atts = array( 'style' => array( 'typography' => array( 'fontFamily' => 'var:preset|font-family|h1' ) ) ); 182 195 … … 185 198 186 199 $this->assertSame( $expected, $actual ); 187 unregister_block_type( $block_name );188 200 } 189 201 /** … … 193 205 */ 194 206 function test_font_family_with_class() { 195 $ block_name = 'test/font-family-with-class';196 register_block_type( 197 $ block_name,207 $this->test_block_name = 'test/font-family-with-class'; 208 register_block_type( 209 $this->test_block_name, 198 210 array( 199 211 'api_version' => 2, … … 211 223 ); 212 224 $registry = WP_Block_Type_Registry::get_instance(); 213 $block_type = $registry->get_registered( $ block_name );225 $block_type = $registry->get_registered( $this->test_block_name ); 214 226 $block_atts = array( 'fontFamily' => 'h1' ); 215 227 … … 218 230 219 231 $this->assertSame( $expected, $actual ); 220 unregister_block_type( $block_name );221 232 } 222 233
Note: See TracChangeset
for help on using the changeset viewer.