Changeset 55955 for trunk/tests/phpunit/tests/blocks/editor.php
- Timestamp:
- 06/21/2023 04:21:04 AM (3 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/blocks/editor.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/blocks/editor.php
r55822 r55955 28 28 $wp_rest_server = new Spy_REST_Server(); 29 29 do_action( 'rest_api_init', $wp_rest_server ); 30 31 global $post_ID; 32 $post_ID = 1; 30 33 } 31 34 … … 34 37 global $wp_rest_server; 35 38 $wp_rest_server = null; 39 global $post_ID; 40 $post_ID = null; 36 41 parent::tear_down(); 37 42 } … … 398 403 399 404 /** 405 * @ticket 58534 406 */ 407 public function test_wp_get_first_block() { 408 $block_name = 'core/paragraph'; 409 $blocks = array( 410 array( 411 'blockName' => 'core/image', 412 ), 413 array( 414 'blockName' => $block_name, 415 'attrs' => array( 416 'content' => 'Hello World!', 417 ), 418 ), 419 array( 420 'blockName' => 'core/heading', 421 ), 422 array( 423 'blockName' => $block_name, 424 ), 425 ); 426 $blocks_with_no_paragraph = array( 427 array( 428 'blockName' => 'core/image', 429 ), 430 array( 431 'blockName' => 'core/heading', 432 ), 433 ); 434 435 $this->assertSame( $blocks[1], wp_get_first_block( $blocks, $block_name ) ); 436 437 $this->assertSame( array(), wp_get_first_block( $blocks_with_no_paragraph, $block_name ) ); 438 } 439 440 /** 441 * @ticket 58534 442 */ 443 public function test_wp_get_post_content_block_attributes() { 444 $attributes_with_layout = array( 445 'layout' => array( 446 'type' => 'constrained', 447 ), 448 ); 449 // With no block theme, expect an empty array. 450 $this->assertSame( array(), wp_get_post_content_block_attributes() ); 451 452 switch_theme( 'block-theme' ); 453 454 $this->assertSame( $attributes_with_layout, wp_get_post_content_block_attributes() ); 455 } 456 457 /** 400 458 * @ticket 53458 401 459 */ … … 457 515 // settings.spacing.customPadding 458 516 $this->assertTrue( $settings['enableCustomSpacing'] ); 517 // settings.postContentAttributes 518 $this->assertSameSets( 519 array( 520 'layout' => array( 521 'type' => 'constrained', 522 ), 523 ), 524 $settings['postContentAttributes'] 525 ); 459 526 460 527 switch_theme( WP_DEFAULT_THEME );
Note: See TracChangeset
for help on using the changeset viewer.