Changeset 53153
- Timestamp:
- 04/12/2022 09:38:18 AM (3 years ago)
- Location:
- trunk/tests/phpunit/tests/block-supports
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/block-supports/border.php
r53128 r53153 5 5 class Test_Block_Supports_Border 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 55505 8 24 * … … 10 26 */ 11 27 function test_border_color_slug_with_numbers_is_kebab_cased_properly() { 12 $ block_name = 'test/border-color-slug-with-numbers-is-kebab-cased-properly';28 $this->test_block_name = 'test/border-color-slug-with-numbers-is-kebab-cased-properly'; 13 29 register_block_type( 14 $ block_name,30 $this->test_block_name, 15 31 array( 16 32 'api_version' => 2, … … 34 50 ); 35 51 $registry = WP_Block_Type_Registry::get_instance(); 36 $block_type = $registry->get_registered( $ block_name );52 $block_type = $registry->get_registered( $this->test_block_name ); 37 53 $block_atts = array( 38 54 'borderColor' => 'red', … … 53 69 54 70 $this->assertSame( $expected, $actual ); 55 unregister_block_type( $block_name );56 71 } 57 72 … … 62 77 */ 63 78 function test_border_with_skipped_serialization_block_supports() { 64 $ block_name = 'test/border-with-skipped-serialization-block-supports';79 $this->test_block_name = 'test/border-with-skipped-serialization-block-supports'; 65 80 register_block_type( 66 $ block_name,81 $this->test_block_name, 67 82 array( 68 83 'api_version' => 2, … … 84 99 ); 85 100 $registry = WP_Block_Type_Registry::get_instance(); 86 $block_type = $registry->get_registered( $ block_name );101 $block_type = $registry->get_registered( $this->test_block_name ); 87 102 $block_atts = array( 88 103 'style' => array( … … 100 115 101 116 $this->assertSame( $expected, $actual ); 102 unregister_block_type( $block_name );103 117 } 104 118 … … 109 123 */ 110 124 function test_radius_with_individual_skipped_serialization_block_supports() { 111 $ block_name = 'test/radius-with-individual-skipped-serialization-block-supports';125 $this->test_block_name = 'test/radius-with-individual-skipped-serialization-block-supports'; 112 126 register_block_type( 113 $ block_name,127 $this->test_block_name, 114 128 array( 115 129 'api_version' => 2, … … 131 145 ); 132 146 $registry = WP_Block_Type_Registry::get_instance(); 133 $block_type = $registry->get_registered( $ block_name );147 $block_type = $registry->get_registered( $this->test_block_name ); 134 148 $block_atts = array( 135 149 'style' => array( … … 149 163 150 164 $this->assertSame( $expected, $actual ); 151 unregister_block_type( $block_name );152 165 } 153 166 } -
trunk/tests/phpunit/tests/block-supports/colors.php
r53128 r53153 5 5 class Tests_Block_Supports_Colors 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_color_slugs_with_numbers_are_kebab_cased_properly() { 28 $this->test_block_name = 'test/color-slug-with-numbers'; 12 29 register_block_type( 13 'test/color-slug-with-numbers',30 $this->test_block_name, 14 31 array( 15 32 'api_version' => 2, … … 35 52 ); 36 53 $registry = WP_Block_Type_Registry::get_instance(); 37 $block_type = $registry->get_registered( 'test/color-slug-with-numbers');54 $block_type = $registry->get_registered( $this->test_block_name ); 38 55 39 56 $block_atts = array( … … 47 64 48 65 $this->assertSame( $expected, $actual ); 49 unregister_block_type( 'test/color-slug-with-numbers' );50 66 } 51 67 … … 56 72 */ 57 73 function test_color_with_skipped_serialization_block_supports() { 58 $ block_name = 'test/color-with-skipped-serialization-block-supports';74 $this->test_block_name = 'test/color-with-skipped-serialization-block-supports'; 59 75 register_block_type( 60 $ block_name,76 $this->test_block_name, 61 77 array( 62 78 'api_version' => 2, … … 77 93 78 94 $registry = WP_Block_Type_Registry::get_instance(); 79 $block_type = $registry->get_registered( $ block_name );95 $block_type = $registry->get_registered( $this->test_block_name ); 80 96 $block_atts = array( 81 97 'style' => array( … … 91 107 92 108 $this->assertSame( $expected, $actual ); 93 unregister_block_type( $block_name );94 109 } 95 110 … … 100 115 */ 101 116 function test_gradient_with_individual_skipped_serialization_block_supports() { 102 $ block_name = 'test/gradient-with-individual-skipped-serialization-block-support';117 $this->test_block_name = 'test/gradient-with-individual-skipped-serialization-block-support'; 103 118 register_block_type( 104 $ block_name,119 $this->test_block_name, 105 120 array( 106 121 'api_version' => 2, … … 121 136 122 137 $registry = WP_Block_Type_Registry::get_instance(); 123 $block_type = $registry->get_registered( $ block_name );138 $block_type = $registry->get_registered( $this->test_block_name ); 124 139 $block_atts = array( 125 140 'style' => array( … … 137 152 138 153 $this->assertSame( $expected, $actual ); 139 unregister_block_type( $block_name );140 154 } 141 155 } -
trunk/tests/phpunit/tests/block-supports/spacing.php
r53128 r53153 5 5 class Test_Block_Supports_Spacing 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 55505 8 24 * … … 10 26 */ 11 27 function test_spacing_style_is_applied() { 12 $ block_name = 'test/spacing-style-is-applied';28 $this->test_block_name = 'test/spacing-style-is-applied'; 13 29 register_block_type( 14 $ block_name,30 $this->test_block_name, 15 31 array( 16 32 'api_version' => 2, … … 30 46 ); 31 47 $registry = WP_Block_Type_Registry::get_instance(); 32 $block_type = $registry->get_registered( $ block_name );48 $block_type = $registry->get_registered( $this->test_block_name ); 33 49 $block_atts = array( 34 50 'style' => array( … … 52 68 53 69 $this->assertSame( $expected, $actual ); 54 unregister_block_type( $block_name );55 70 } 56 71 … … 61 76 */ 62 77 function test_spacing_with_skipped_serialization_block_supports() { 63 $ block_name = 'test/spacing-with-skipped-serialization-block-supports';78 $this->test_block_name = 'test/spacing-with-skipped-serialization-block-supports'; 64 79 register_block_type( 65 $ block_name,80 $this->test_block_name, 66 81 array( 67 82 'api_version' => 2, … … 82 97 ); 83 98 $registry = WP_Block_Type_Registry::get_instance(); 84 $block_type = $registry->get_registered( $ block_name );99 $block_type = $registry->get_registered( $this->test_block_name ); 85 100 $block_atts = array( 86 101 'style' => array( … … 102 117 103 118 $this->assertSame( $expected, $actual ); 104 unregister_block_type( $block_name );105 119 } 106 120 … … 111 125 */ 112 126 function test_margin_with_individual_skipped_serialization_block_supports() { 113 $ block_name = 'test/margin-with-individual-skipped-serialization-block-supports';127 $this->test_block_name = 'test/margin-with-individual-skipped-serialization-block-supports'; 114 128 register_block_type( 115 $ block_name,129 $this->test_block_name, 116 130 array( 117 131 'api_version' => 2, … … 132 146 ); 133 147 $registry = WP_Block_Type_Registry::get_instance(); 134 $block_type = $registry->get_registered( $ block_name );148 $block_type = $registry->get_registered( $this->test_block_name ); 135 149 $block_atts = array( 136 150 'style' => array( … … 154 168 155 169 $this->assertSame( $expected, $actual ); 156 unregister_block_type( $block_name );157 170 } 158 171 } -
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.