Changeset 58802 for branches/6.6/tests/phpunit/tests/block-templates/injectIgnoredHookedBlocksMetadataAttributes.php
- Timestamp:
- 07/24/2024 02:38:24 PM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.6/tests/phpunit/tests/block-templates/injectIgnoredHookedBlocksMetadataAttributes.php
r58042 r58802 420 420 ); 421 421 } 422 423 /** 424 * @ticket 61550 425 */ 426 public function test_inject_ignored_hooked_blocks_metadata_attributes_into_template_with_no_changes_to_post_content() { 427 register_block_type( 428 'tests/hooked-block', 429 array( 430 'block_hooks' => array( 431 'core/heading' => 'after', 432 ), 433 ) 434 ); 435 436 $id = self::TEST_THEME . '//' . 'my_template'; 437 $template = get_block_template( $id, 'wp_template' ); 438 439 $changes = new stdClass(); 440 $changes->ID = $template->wp_id; 441 442 // Note that we're not setting `$changes->post_content`! 443 444 $post = inject_ignored_hooked_blocks_metadata_attributes( $changes ); 445 $this->assertFalse( 446 isset( $post->post_content ), 447 "post_content shouldn't have been set." 448 ); 449 } 450 451 /** 452 * @ticket 61550 453 */ 454 public function test_inject_ignored_hooked_blocks_metadata_attributes_into_template_part_with_no_changes_to_post_content() { 455 register_block_type( 456 'tests/hooked-block', 457 array( 458 'block_hooks' => array( 459 'core/heading' => 'after', 460 ), 461 ) 462 ); 463 464 $id = self::TEST_THEME . '//' . 'my_template_part'; 465 $template = get_block_template( $id, 'wp_template_part' ); 466 467 $changes = new stdClass(); 468 $changes->ID = $template->wp_id; 469 // Note that we're not setting `$changes->post_content`! 470 471 $post = inject_ignored_hooked_blocks_metadata_attributes( $changes ); 472 $this->assertFalse( 473 isset( $post->post_content ), 474 "post_content shouldn't have been set." 475 ); 476 } 422 477 }
Note: See TracChangeset
for help on using the changeset viewer.