mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Coding Standards: Fix a non-snake_case function name in WP_Block tests.
As the filter is only intended for a single test, it can be converted to a closure instead of being declared as a function in the global namespace. The `remove_filter()` part is redundant, as `WP_UnitTestCase_Base` saves the state of filter-related globals at `set_up()` and restores them on `tear_down()`. Follow-up to [54175]. Props jrf, SergeyBiryukov. See #56791. git-svn-id: https://develop.svn.wordpress.org/trunk@54917 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2380400e44
commit
999b52eb75
@ -604,13 +604,18 @@ class Tests_Blocks_wpBlock extends WP_UnitTestCase {
|
||||
),
|
||||
);
|
||||
$block = new WP_Block( $parsed_block, $context, $this->registry );
|
||||
function filterQuery( $query, $block, $page ) {
|
||||
$query['post_type'] = 'book';
|
||||
return $query;
|
||||
}
|
||||
add_filter( 'query_loop_block_query_vars', 'filterQuery', 10, 3 );
|
||||
|
||||
add_filter(
|
||||
'query_loop_block_query_vars',
|
||||
static function( $query, $block, $page ) {
|
||||
$query['post_type'] = 'book';
|
||||
return $query;
|
||||
},
|
||||
10,
|
||||
3
|
||||
);
|
||||
|
||||
$query = build_query_vars_from_query_block( $block, 1 );
|
||||
remove_filter( 'query_loop_block_query_vars', 'filterQuery' );
|
||||
$this->assertSame(
|
||||
$query,
|
||||
array(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user