- Timestamp:
- 02/20/2024 03:20:39 PM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/blocks/setIgnoredHookedBlocksMetadata.php
r57666 r57668 145 145 ); 146 146 } 147 148 /** 149 * @ticket 60580 150 * 151 * @covers ::set_ignored_hooked_blocks_metadata 152 */ 153 public function test_set_ignored_hooked_blocks_metadata_for_block_suppressed_by_filter() { 154 $anchor_block = array( 155 'blockName' => 'tests/anchor-block', 156 'attrs' => array(), 157 ); 158 159 $hooked_blocks = array( 160 'tests/anchor-block' => array( 161 'after' => array( 'tests/hooked-block', 'tests/hooked-block-suppressed-by-filter' ), 162 ), 163 ); 164 165 $filter = function ( $parsed_hooked_block, $hooked_block_type, $relative_position, $parsed_anchor_block ) { 166 if ( 'tests/anchor-block' === $parsed_anchor_block['blockName'] && 'after' === $relative_position ) { 167 return null; 168 } 169 170 return $parsed_hooked_block; 171 }; 172 173 add_filter( 'hooked_block_tests/hooked-block-suppressed-by-filter', $filter, 10, 4 ); 174 set_ignored_hooked_blocks_metadata( $anchor_block, 'after', $hooked_blocks, null ); 175 remove_filter( 'hooked_block_tests/hooked-block-suppressed-by-filter', $filter ); 176 177 $this->assertSame( array( 'tests/hooked-block' ), $anchor_block['attrs']['metadata']['ignoredHookedBlocks'] ); 178 } 147 179 }
Note: See TracChangeset
for help on using the changeset viewer.