Changeset 60189 for branches/6.8/tests/phpunit/tests/blocks/applyBlockHooksToContentFromPostObject.php
- Timestamp:
- 04/25/2025 07:21:31 PM (7 weeks ago)
- Location:
- branches/6.8
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.8
-
branches/6.8/tests/phpunit/tests/blocks/applyBlockHooksToContentFromPostObject.php
r59838 r60189 89 89 ) 90 90 ); 91 92 register_block_type( 93 'tests/hooked-block-after-post-content', 94 array( 95 'block_hooks' => array( 96 'core/post-content' => 'after', 97 ), 98 ) 99 ); 100 101 register_block_type( 'tests/dynamically-hooked-block-before-post-content' ); 91 102 } 92 103 … … 101 112 $registry->unregister( 'tests/hooked-block' ); 102 113 $registry->unregister( 'tests/hooked-block-first-child' ); 114 $registry->unregister( 'tests/hooked-block-after-post-content' ); 115 $registry->unregister( 'tests/dynamically-hooked-block-before-post-content' ); 103 116 } 104 117 … … 132 145 133 146 /** 147 * @ticket 63287 148 */ 149 public function test_apply_block_hooks_to_content_from_post_object_does_not_insert_hooked_block_before_container_block() { 150 $filter = function ( $hooked_block_types, $relative_position, $anchor_block_type ) { 151 if ( 'core/post-content' === $anchor_block_type && 'before' === $relative_position ) { 152 $hooked_block_types[] = 'tests/dynamically-hooked-block-before-post-content'; 153 } 154 155 return $hooked_block_types; 156 }; 157 158 $expected = '<!-- wp:tests/hooked-block-first-child /-->' . 159 self::$post->post_content . 160 '<!-- wp:tests/hooked-block /-->'; 161 162 add_filter( 'hooked_block_types', $filter, 10, 3 ); 163 $actual = apply_block_hooks_to_content_from_post_object( 164 self::$post->post_content, 165 self::$post, 166 'insert_hooked_blocks' 167 ); 168 remove_filter( 'hooked_block_types', $filter, 10 ); 169 170 $this->assertSame( $expected, $actual ); 171 } 172 173 /** 134 174 * @ticket 62716 135 175 */
Note: See TracChangeset
for help on using the changeset viewer.