- Timestamp:
- 02/13/2024 03:10:21 PM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/block-templates/buildBlockTemplateResultFromPost.php
r57594 r57627 19 19 if ( $registry->is_registered( 'tests/my-block' ) ) { 20 20 $registry->unregister( 'tests/my-block' ); 21 } 22 23 if ( $registry->is_registered( 'tests/ignored' ) ) { 24 $registry->unregister( 'tests/ignored' ); 21 25 } 22 26 … … 68 72 /** 69 73 * @ticket 59646 74 * @ticket 60506 70 75 */ 71 76 public function test_should_inject_hooked_block_into_template() { … … 84 89 ); 85 90 $this->assertStringStartsWith( '<!-- wp:tests/my-block /-->', $template->content ); 86 $this->assertStringContainsString( '"metadata":{"ignoredHookedBlocks":["tests/my-block"]}', $template->content );87 91 } 88 92 89 93 /** 90 94 * @ticket 59646 95 * @ticket 60506 91 96 */ 92 97 public function test_should_inject_hooked_block_into_template_part() { … … 105 110 ); 106 111 $this->assertStringEndsWith( '<!-- wp:tests/my-block /-->', $template_part->content ); 107 $this->assertStringContainsString( '"metadata":{"ignoredHookedBlocks":["tests/my-block"]}', $template_part->content ); 112 } 113 114 /** 115 * @ticket 59646 116 * @ticket 60506 117 */ 118 public function test_should_not_inject_ignored_hooked_block_into_template() { 119 register_block_type( 120 'tests/ignored', 121 array( 122 'block_hooks' => array( 123 'core/heading' => 'after', 124 ), 125 ) 126 ); 127 128 $template = _build_block_template_result_from_post( 129 self::$template_post, 130 'wp_template' 131 ); 132 $this->assertStringNotContainsString( '<!-- wp:tests/ignored /-->', $template->content ); 133 } 134 135 /** 136 * @ticket 59646 137 * @ticket 60506 138 */ 139 public function test_should_not_inject_ignored_hooked_block_into_template_part() { 140 register_block_type( 141 'tests/ignored', 142 array( 143 'block_hooks' => array( 144 'core/heading' => 'after', 145 ), 146 ) 147 ); 148 149 $template_part = _build_block_template_result_from_post( 150 self::$template_part_post, 151 'wp_template_part' 152 ); 153 $this->assertStringNotContainsString( '<!-- wp:tests/ignored /-->', $template_part->content ); 108 154 } 109 155 }
Note: See TracChangeset
for help on using the changeset viewer.