mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Block Hooks: Make test a bit easier to read.
Follow-up [57668]. Props gziolo. See #60580. git-svn-id: https://develop.svn.wordpress.org/trunk@57676 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4ba0963a1f
commit
299e2adb44
@ -163,16 +163,20 @@ class Tests_Blocks_SetIgnoredHookedBlocksMetadata extends WP_UnitTestCase {
|
||||
);
|
||||
|
||||
$filter = function ( $parsed_hooked_block, $hooked_block_type, $relative_position, $parsed_anchor_block ) {
|
||||
if ( 'tests/anchor-block' === $parsed_anchor_block['blockName'] && 'after' === $relative_position ) {
|
||||
if (
|
||||
'tests/hooked-block-suppressed-by-filter' === $hooked_block_type &&
|
||||
'after' === $relative_position &&
|
||||
'tests/anchor-block' === $parsed_anchor_block['blockName']
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $parsed_hooked_block;
|
||||
};
|
||||
|
||||
add_filter( 'hooked_block_tests/hooked-block-suppressed-by-filter', $filter, 10, 4 );
|
||||
add_filter( 'hooked_block', $filter, 10, 4 );
|
||||
set_ignored_hooked_blocks_metadata( $anchor_block, 'after', $hooked_blocks, null );
|
||||
remove_filter( 'hooked_block_tests/hooked-block-suppressed-by-filter', $filter );
|
||||
remove_filter( 'hooked_block', $filter );
|
||||
|
||||
$this->assertSame( array( 'tests/hooked-block' ), $anchor_block['attrs']['metadata']['ignoredHookedBlocks'] );
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user