Changeset 59095 for trunk/tests/phpunit/tests/block-bindings/render.php
- Timestamp:
- 09/26/2024 02:49:13 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/block-bindings/render.php
r59080 r59095 335 335 336 336 /** 337 * Tests if the `__default` attribute is replaced with real attribu es for337 * Tests if the `__default` attribute is replaced with real attributes for 338 338 * pattern overrides. 339 339 * 340 340 * @ticket 61333 341 * @ticket 62069 341 342 * 342 343 * @covers WP_Block::process_block_bindings 343 344 */ 344 345 public function test_default_binding_for_pattern_overrides() { 345 $expected_content = 'This is the content value';346 347 346 $block_content = <<<HTML 348 347 <!-- wp:paragraph {"metadata":{"bindings":{"__default":{"source":"core/pattern-overrides"}},"name":"Test"}} --> … … 351 350 HTML; 352 351 353 $parsed_blocks = parse_blocks( $block_content ); 354 $block = new WP_Block( $parsed_blocks[0], array( 'pattern/overrides' => array( 'Test' => array( 'content' => $expected_content ) ) ) ); 355 $result = $block->render(); 352 $expected_content = 'This is the content value'; 353 $parsed_blocks = parse_blocks( $block_content ); 354 $block = new WP_Block( $parsed_blocks[0], array( 'pattern/overrides' => array( 'Test' => array( 'content' => $expected_content ) ) ) ); 355 356 $result = $block->render(); 356 357 357 358 $this->assertSame( … … 359 360 trim( $result ), 360 361 'The `__default` attribute should be replaced with the real attribute prior to the callback.' 362 ); 363 364 $expected_bindings_metadata = array( 365 'content' => array( 'source' => 'core/pattern-overrides' ), 366 ); 367 $this->assertSame( 368 $expected_bindings_metadata, 369 $block->attributes['metadata']['bindings'], 370 'The __default binding should be updated with the individual binding attributes in the block metadata.' 361 371 ); 362 372 }
Note: See TracChangeset
for help on using the changeset viewer.