Changeset 61009 for trunk/tests/phpunit/tests/blocks/renderReusable.php
- Timestamp:
- 10/21/2025 07:11:53 AM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/blocks/renderReusable.php
r57032 r61009 78 78 79 79 public function test_render() { 80 $block_type = WP_Block_Type_Registry::get_instance()->get_registered( 'core/block' ); 81 $output = $block_type->render( array( 'ref' => self::$block_id ) ); 80 $parsed_block = array( 81 'blockName' => 'core/block', 82 'attrs' => array( 'ref' => self::$block_id ), 83 ); 84 $block = new WP_Block( $parsed_block ); 85 $output = $block->render(); 82 86 $this->assertSame( '<p>Hello world!</p>', $output ); 83 87 } … … 89 93 */ 90 94 public function test_render_subsequent() { 91 $block_type = WP_Block_Type_Registry::get_instance()->get_registered( 'core/block' ); 92 $output = $block_type->render( array( 'ref' => self::$block_id ) ); 93 $output .= $block_type->render( array( 'ref' => self::$block_id ) ); 95 $parsed_block = array( 96 'blockName' => 'core/block', 97 'attrs' => array( 'ref' => self::$block_id ), 98 ); 99 $block = new WP_Block( $parsed_block ); 100 $output = $block->render(); 101 $output .= $block->render(); 94 102 $this->assertSame( '<p>Hello world!</p><p>Hello world!</p>', $output ); 95 103 } 96 104 97 105 public function test_ref_empty() { 98 $block_type = WP_Block_Type_Registry::get_instance()->get_registered( 'core/block' ); 99 $output = $block_type->render( array() ); 106 $parsed_block = array( 107 'blockName' => 'core/block', 108 'attrs' => array(), 109 ); 110 $block = new WP_Block( $parsed_block ); 111 $output = $block->render(); 100 112 $this->assertSame( '', $output ); 101 113 } 102 114 103 115 public function test_ref_wrong_post_type() { 104 $block_type = WP_Block_Type_Registry::get_instance()->get_registered( 'core/block' ); 105 $output = $block_type->render( array( 'ref' => self::$post_id ) ); 116 $parsed_block = array( 117 'blockName' => 'core/block', 118 'attrs' => array( 'ref' => self::$post_id ), 119 ); 120 $block = new WP_Block( $parsed_block ); 121 $output = $block->render(); 106 122 $this->assertSame( '', $output ); 107 123 }
Note: See TracChangeset
for help on using the changeset viewer.