Changeset 56557 for trunk/tests/phpunit/tests/blocks/serialize.php
- Timestamp:
- 09/12/2023 01:00:32 PM (16 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/blocks/serialize.php
r56547 r56557 55 55 $this->assertSame( 'plugin/example', strip_core_block_namespace( 'plugin/example' ) ); 56 56 } 57 58 /** 59 * @ticket 59327 60 * 61 * @covers ::serialize_blocks 62 */ 63 public function test_callback_argument() { 64 $markup = "<!-- wp:outer --><!-- wp:inner {\"key\":\"value\"} -->Example.<!-- /wp:inner -->\n\nExample.\n\n<!-- wp:void /--><!-- /wp:outer -->"; 65 $blocks = parse_blocks( $markup ); 66 67 $actual = serialize_blocks( $blocks, array( __CLASS__, 'add_attribute_to_inner_block' ) ); 68 69 $this->assertSame( 70 "<!-- wp:outer --><!-- wp:inner {\"key\":\"value\",\"myattr\":\"myvalue\"} -->Example.<!-- /wp:inner -->\n\nExample.\n\n<!-- wp:void /--><!-- /wp:outer -->", 71 $actual 72 ); 73 } 74 75 public static function add_attribute_to_inner_block( $block ) { 76 if ( 'core/inner' === $block['blockName'] ) { 77 $block['attrs']['myattr'] = 'myvalue'; 78 } 79 return $block; 80 } 57 81 }
Note: See TracChangeset
for help on using the changeset viewer.