Changeset 54155 for trunk/tests/phpunit/tests/blocks/register.php
- Timestamp:
- 09/14/2022 10:50:26 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/blocks/register.php
r54132 r54155 149 149 $this->assertSame( 150 150 'unit-tests-my-block-script', 151 generate_block_asset_handle( $block_name, 'script' )152 ); 153 $this->assertSame( 154 'unit-tests-my-block-view-script ',155 generate_block_asset_handle( $block_name, 'viewScript' )156 ); 157 $this->assertSame( 158 'unit-tests-my-block-editor-style ',159 generate_block_asset_handle( $block_name, 'editorStyle' )151 generate_block_asset_handle( $block_name, 'script', 0 ) 152 ); 153 $this->assertSame( 154 'unit-tests-my-block-view-script-100', 155 generate_block_asset_handle( $block_name, 'viewScript', 99 ) 156 ); 157 $this->assertSame( 158 'unit-tests-my-block-editor-style-2', 159 generate_block_asset_handle( $block_name, 'editorStyle', 1 ) 160 160 ); 161 161 $this->assertSame( … … 177 177 $this->assertSame( 178 178 'wp-block-paragraph', 179 generate_block_asset_handle( $block_name, 'script' )180 ); 181 $this->assertSame( 182 'wp-block-paragraph-view ',183 generate_block_asset_handle( $block_name, 'viewScript' )184 ); 185 $this->assertSame( 186 'wp-block-paragraph-editor ',187 generate_block_asset_handle( $block_name, 'editorStyle' )179 generate_block_asset_handle( $block_name, 'script', 0 ) 180 ); 181 $this->assertSame( 182 'wp-block-paragraph-view-100', 183 generate_block_asset_handle( $block_name, 'viewScript', 99 ) 184 ); 185 $this->assertSame( 186 'wp-block-paragraph-editor-2', 187 generate_block_asset_handle( $block_name, 'editorStyle', 1 ) 188 188 ); 189 189 $this->assertSame( … … 205 205 * @ticket 50263 206 206 */ 207 public function test_empty_ value_register_block_script_handle() {207 public function test_empty_string_value_do_not_register_block_script_handle() { 208 208 $metadata = array( 'script' => '' ); 209 209 $result = register_block_script_handle( $metadata, 'script' ); 210 211 $this->assertFalse( $result ); 212 } 213 214 public function test_empty_array_value_do_not_register_block_script_handle() { 215 $metadata = array( 'script' => array() ); 216 $result = register_block_script_handle( $metadata, 'script' ); 217 218 $this->assertFalse( $result ); 219 } 220 221 public function test_wrong_array_index_do_not_register_block_script_handle() { 222 $metadata = array( 'script' => array( 'test-script-handle' ) ); 223 $result = register_block_script_handle( $metadata, 'script', 1 ); 210 224 211 225 $this->assertFalse( $result ); … … 232 246 public function test_handle_passed_register_block_script_handle() { 233 247 $metadata = array( 234 ' editorScript' => 'test-script-handle',235 ); 236 $result = register_block_script_handle( $metadata, ' editorScript' );248 'script' => 'test-script-handle', 249 ); 250 $result = register_block_script_handle( $metadata, 'script' ); 237 251 238 252 $this->assertSame( 'test-script-handle', $result ); 253 } 254 255 public function test_handles_passed_register_block_script_handles() { 256 $metadata = array( 257 'script' => array( 'test-script-handle', 'test-script-handle-2' ), 258 ); 259 260 $result = register_block_script_handle( $metadata, 'script' ); 261 $this->assertSame( 'test-script-handle', $result ); 262 263 $result = register_block_script_handle( $metadata, 'script', 1 ); 264 $this->assertSame( 'test-script-handle-2', $result, 1 ); 239 265 } 240 266 … … 282 308 * @ticket 50263 283 309 */ 284 public function test_empty_ value_found_register_block_style_handle() {310 public function test_empty_string_value_do_not_register_block_style_handle() { 285 311 $metadata = array( 'style' => '' ); 286 312 $result = register_block_style_handle( $metadata, 'style' ); … … 289 315 } 290 316 317 public function test_empty_array_value_do_not_register_block_style_handle() { 318 $metadata = array( 'style' => array() ); 319 $result = register_block_style_handle( $metadata, 'style' ); 320 321 $this->assertFalse( $result ); 322 } 323 324 public function test_wrong_array_index_do_not_register_block_style_handle() { 325 $metadata = array( 'style' => array( 'test-style-handle' ) ); 326 $result = register_block_style_handle( $metadata, 'style', 1 ); 327 328 $this->assertFalse( $result ); 329 } 330 291 331 /** 292 332 * @ticket 50263 … … 299 339 300 340 $this->assertSame( 'test-style-handle', $result ); 341 } 342 343 public function test_handles_passed_register_block_style_handles() { 344 $metadata = array( 345 'style' => array( 'test-style-handle', 'test-style-handle-2' ), 346 ); 347 348 $result = register_block_style_handle( $metadata, 'style' ); 349 $this->assertSame( 'test-style-handle', $result ); 350 351 $result = register_block_style_handle( $metadata, 'style', 1 ); 352 $this->assertSame( 'test-style-handle-2', $result, 1 ); 301 353 } 302 354 … … 443 495 $result->example 444 496 ); 445 $this->assertSame( 'tests-notice-editor-script', $result->editor_script ); 446 $this->assertSame( 'tests-notice-script', $result->script ); 447 $this->assertSame( 'tests-notice-view-script', $result->view_script ); 448 $this->assertSame( 'tests-notice-editor-style', $result->editor_style ); 449 $this->assertSame( 'tests-notice-style', $result->style ); 497 $this->assertSameSets( 498 array( 'tests-notice-editor-script' ), 499 $result->editor_script_handles 500 ); 501 $this->assertSameSets( 502 array( 'tests-notice-script' ), 503 $result->script_handles 504 ); 505 $this->assertSameSets( 506 array( 'tests-notice-view-script', 'tests-notice-view-script-2' ), 507 $result->view_script_handles 508 ); 509 $this->assertSameSets( 510 array( 'tests-notice-editor-style' ), 511 $result->editor_style_handles 512 ); 513 $this->assertSameSets( 514 array( 'tests-notice-style', 'tests-notice-style-2' ), 515 $result->style_handles 516 ); 450 517 451 518 // @ticket 50328
Note: See TracChangeset
for help on using the changeset viewer.