From e00411da30aee31c21533fce7164f5c71155f4de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20W=C3=BCnsch?= Date: Tue, 4 Aug 2026 10:06:44 +0200 Subject: [PATCH] Build/Test Tools: Remove redundant `$accepted_args` from `remove_filter()`/`remove_action()` calls. `remove_filter()` and `remove_action()` only accept `$hook_name`, `$callback` and `$priority`. A fourth argument mirroring the `$accepted_args` of the corresponding `add_filter()`/`add_action()` call is silently ignored and wrongly suggests that the number of accepted arguments is part of the callback identity. This removes the superfluous fourth argument throughout the PHPUnit test suite, and also drops the explicit default priority of `10` where it is not needed. Non-default priorities are kept. --- .../includes/testcase-rest-controller.php | 2 +- tests/phpunit/includes/utils.php | 4 ++-- tests/phpunit/tests/actions.php | 4 ++-- tests/phpunit/tests/ajax/wpAjaxResponse.php | 2 +- tests/phpunit/tests/comment.php | 2 +- tests/phpunit/tests/comment/query.php | 2 +- tests/phpunit/tests/comment/template.php | 2 +- tests/phpunit/tests/filters.php | 2 +- tests/phpunit/tests/formatting/wpTexturize.php | 6 +++--- tests/phpunit/tests/media.php | 2 +- tests/phpunit/tests/multisite/site.php | 4 ++-- tests/phpunit/tests/multisite/wpNetworkQuery.php | 2 +- tests/phpunit/tests/multisite/wpSiteQuery.php | 2 +- tests/phpunit/tests/post.php | 2 +- tests/phpunit/tests/post/attachments.php | 2 +- tests/phpunit/tests/post/nav-menu.php | 16 ++++++++-------- tests/phpunit/tests/post/wpInsertPost.php | 2 +- .../tests/rest-api/rest-comments-controller.php | 4 ++-- .../tests/rest-api/rest-posts-controller.php | 4 ++-- .../tests/rest-api/rest-tags-controller.php | 8 ++++---- tests/phpunit/tests/shortcode.php | 6 +++--- tests/phpunit/tests/term/query.php | 2 +- tests/phpunit/tests/term/wpGetObjectTerms.php | 2 +- tests/phpunit/tests/term/wpInsertTerm.php | 2 +- tests/phpunit/tests/user/capabilities.php | 4 ++-- tests/phpunit/tests/user/query.php | 2 +- tests/phpunit/tests/xmlrpc/wp/getPages.php | 2 +- 27 files changed, 47 insertions(+), 47 deletions(-) diff --git a/tests/phpunit/includes/testcase-rest-controller.php b/tests/phpunit/includes/testcase-rest-controller.php index 9a4c2a0b61b2c..43939ad3c739b 100644 --- a/tests/phpunit/includes/testcase-rest-controller.php +++ b/tests/phpunit/includes/testcase-rest-controller.php @@ -14,7 +14,7 @@ public function set_up() { } public function tear_down() { - remove_filter( 'rest_url', array( $this, 'test_rest_url_for_leading_slash' ), 10, 2 ); + remove_filter( 'rest_url', array( $this, 'test_rest_url_for_leading_slash' ) ); /** @var WP_REST_Server $wp_rest_server */ global $wp_rest_server; $wp_rest_server = null; diff --git a/tests/phpunit/includes/utils.php b/tests/phpunit/includes/utils.php index 02254903fa745..de8de4b9151d6 100644 --- a/tests/phpunit/includes/utils.php +++ b/tests/phpunit/includes/utils.php @@ -617,8 +617,8 @@ function _cleanup_query_vars() { } function _clean_term_filters() { - remove_filter( 'get_terms', array( 'Featured_Content', 'hide_featured_term' ), 10, 2 ); - remove_filter( 'get_the_terms', array( 'Featured_Content', 'hide_the_featured_term' ), 10, 3 ); + remove_filter( 'get_terms', array( 'Featured_Content', 'hide_featured_term' ) ); + remove_filter( 'get_the_terms', array( 'Featured_Content', 'hide_the_featured_term' ) ); } /** diff --git a/tests/phpunit/tests/actions.php b/tests/phpunit/tests/actions.php index 6e7f292b6b71b..4e25cca0e2e99 100644 --- a/tests/phpunit/tests/actions.php +++ b/tests/phpunit/tests/actions.php @@ -620,7 +620,7 @@ public function test_action_callback_manipulation_while_running() { } public function action_that_manipulates_a_running_hook( $hook_name, $mocks ) { - remove_action( $hook_name, array( $mocks[1], 'action' ), 12, 2 ); + remove_action( $hook_name, array( $mocks[1], 'action' ), 12 ); add_action( $hook_name, array( $mocks[2], 'action' ), 12, 2 ); add_action( $hook_name, array( $mocks[3], 'action' ), 13, 2 ); add_action( $hook_name, array( $mocks[4], 'action' ), 10, 2 ); @@ -836,7 +836,7 @@ public function test_do_action_deprecated_with_multiple_params() { add_action( 'tests_do_action_deprecated', array( __CLASS__, 'deprecated_action_callback_multiple_params' ), 10, 2 ); do_action_deprecated( 'tests_do_action_deprecated', array( $p1, $p2 ), '4.6.0' ); - remove_action( 'tests_do_action_deprecated', array( __CLASS__, 'deprecated_action_callback_multiple_params' ), 10, 2 ); + remove_action( 'tests_do_action_deprecated', array( __CLASS__, 'deprecated_action_callback_multiple_params' ) ); $this->assertSame( 'Bar1', $p1->post_title ); $this->assertSame( 'Bar2', $p2->post_title ); diff --git a/tests/phpunit/tests/ajax/wpAjaxResponse.php b/tests/phpunit/tests/ajax/wpAjaxResponse.php index f280ec60ad494..676727e8bdf40 100644 --- a/tests/phpunit/tests/ajax/wpAjaxResponse.php +++ b/tests/phpunit/tests/ajax/wpAjaxResponse.php @@ -39,7 +39,7 @@ public function set_up() { * Remove the wp_die() override, restore error reporting */ public function tear_down() { - remove_filter( 'wp_die_ajax_handler', array( $this, 'getDieHandler' ), 1, 1 ); + remove_filter( 'wp_die_ajax_handler', array( $this, 'getDieHandler' ), 1 ); error_reporting( $this->_error_level ); parent::tear_down(); } diff --git a/tests/phpunit/tests/comment.php b/tests/phpunit/tests/comment.php index 8c7e8d684bc59..4b2bd8f59868b 100644 --- a/tests/phpunit/tests/comment.php +++ b/tests/phpunit/tests/comment.php @@ -301,7 +301,7 @@ public function test_wp_update_comment_is_wp_error() { true ); - remove_filter( 'wp_update_comment_data', array( $this, 'wp_update_comment_data_filter' ), 10, 3 ); + remove_filter( 'wp_update_comment_data', array( $this, 'wp_update_comment_data_filter' ) ); $this->assertWPError( $result ); } diff --git a/tests/phpunit/tests/comment/query.php b/tests/phpunit/tests/comment/query.php index dc870a78ae494..9d2722cf4e4cc 100644 --- a/tests/phpunit/tests/comment/query.php +++ b/tests/phpunit/tests/comment/query.php @@ -5220,7 +5220,7 @@ public function test_comments_pre_query_filter_should_bypass_database_query() { $q = new WP_Comment_Query(); $results = $q->query( array() ); - remove_filter( 'comments_pre_query', array( __CLASS__, 'filter_comments_pre_query' ), 10, 2 ); + remove_filter( 'comments_pre_query', array( __CLASS__, 'filter_comments_pre_query' ) ); // Make sure no queries were executed. $this->assertSame( $num_queries, get_num_queries() ); diff --git a/tests/phpunit/tests/comment/template.php b/tests/phpunit/tests/comment/template.php index 648e8031323a9..712f4f864a773 100644 --- a/tests/phpunit/tests/comment/template.php +++ b/tests/phpunit/tests/comment/template.php @@ -111,7 +111,7 @@ public function test_get_comments_number_text_declension_with_custom_args( $numb $this->assertSame( $output, get_comments_number_text( false, false, $input ) ); - remove_filter( 'gettext_with_context', array( $this, 'enable_comment_number_declension' ), 10, 4 ); + remove_filter( 'gettext_with_context', array( $this, 'enable_comment_number_declension' ) ); } public function enable_comment_number_declension( $translation, $text, $context, $domain ) { diff --git a/tests/phpunit/tests/filters.php b/tests/phpunit/tests/filters.php index 8ce599c388f29..87d72053dbf58 100644 --- a/tests/phpunit/tests/filters.php +++ b/tests/phpunit/tests/filters.php @@ -503,7 +503,7 @@ public function test_apply_filters_deprecated_with_multiple_params() { add_filter( 'tests_apply_filters_deprecated', array( __CLASS__, 'deprecated_filter_callback_multiple_params' ), 10, 2 ); $p1 = apply_filters_deprecated( 'tests_apply_filters_deprecated', array( $p1, $p2 ), '4.6.0' ); - remove_filter( 'tests_apply_filters_deprecated', array( __CLASS__, 'deprecated_filter_callback_multiple_params' ), 10, 2 ); + remove_filter( 'tests_apply_filters_deprecated', array( __CLASS__, 'deprecated_filter_callback_multiple_params' ) ); $this->assertSame( 'Bar1', $p1 ); diff --git a/tests/phpunit/tests/formatting/wpTexturize.php b/tests/phpunit/tests/formatting/wpTexturize.php index fa81245c83bb9..98c7ec23c1fcb 100644 --- a/tests/phpunit/tests/formatting/wpTexturize.php +++ b/tests/phpunit/tests/formatting/wpTexturize.php @@ -1571,7 +1571,7 @@ public function test_translate( $input, $output ) { $result = wptexturize( $input, true ); - remove_filter( 'gettext_with_context', array( $this, 'filter_translate' ), 10, 4 ); + remove_filter( 'gettext_with_context', array( $this, 'filter_translate' ) ); wptexturize( 'reset', true ); $this->assertSame( $output, $result ); @@ -1849,7 +1849,7 @@ public function test_unregistered_shortcodes( $input, $output ) { $output = $this->assertSame( $output, wptexturize( $input ) ); - remove_filter( 'no_texturize_shortcodes', array( $this, 'filter_shortcodes' ), 10, 1 ); + remove_filter( 'no_texturize_shortcodes', array( $this, 'filter_shortcodes' ) ); return $output; } @@ -1996,7 +1996,7 @@ public function test_primes_quotes_translation( $input, $output ) { $result = wptexturize( $input, true ); - remove_filter( 'gettext_with_context', array( $this, 'filter_translate2' ), 10, 4 ); + remove_filter( 'gettext_with_context', array( $this, 'filter_translate2' ) ); wptexturize( 'reset', true ); $this->assertSame( $output, $result ); diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index 5aee3f8b6955f..8bacd7cf96006 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -6255,7 +6255,7 @@ public function test_wp_editor_set_quality_includes_dimensions() { wp_generate_attachment_metadata( $attachment_id, $file ); // Clean up the filter. - remove_filter( 'wp_editor_set_quality', array( $this, 'assert_dimensions_in_wp_editor_set_quality' ), 10, 3 ); + remove_filter( 'wp_editor_set_quality', array( $this, 'assert_dimensions_in_wp_editor_set_quality' ) ); } /** diff --git a/tests/phpunit/tests/multisite/site.php b/tests/phpunit/tests/multisite/site.php index 920a76f6a7e30..1e3807bc690c3 100644 --- a/tests/phpunit/tests/multisite/site.php +++ b/tests/phpunit/tests/multisite/site.php @@ -661,7 +661,7 @@ public function test_invalid_domain_does_not_exist_with_default_site_id() { public function test_domain_filtered_to_exist() { add_filter( 'domain_exists', array( $this, 'domain_exists_cb' ), 10, 4 ); $exists = domain_exists( 'foo', 'bar' ); - remove_filter( 'domain_exists', array( $this, 'domain_exists_cb' ), 10, 4 ); + remove_filter( 'domain_exists', array( $this, 'domain_exists_cb' ) ); $this->assertSame( 1234, $exists ); } @@ -673,7 +673,7 @@ public function test_slashed_path_in_domain_exists() { add_filter( 'domain_exists', array( $this, 'domain_exists_cb' ), 10, 4 ); $exists1 = domain_exists( 'foo', 'bar' ); $exists2 = domain_exists( 'foo', 'bar/' ); - remove_filter( 'domain_exists', array( $this, 'domain_exists_cb' ), 10, 4 ); + remove_filter( 'domain_exists', array( $this, 'domain_exists_cb' ) ); // Make sure the same result is returned with or without a trailing slash. $this->assertSame( $exists1, $exists2 ); diff --git a/tests/phpunit/tests/multisite/wpNetworkQuery.php b/tests/phpunit/tests/multisite/wpNetworkQuery.php index 92f881419e089..03ece1905dc59 100644 --- a/tests/phpunit/tests/multisite/wpNetworkQuery.php +++ b/tests/phpunit/tests/multisite/wpNetworkQuery.php @@ -568,7 +568,7 @@ public function test_networks_pre_query_filter_should_bypass_database_query() { $q = new WP_Network_Query(); $results = $q->query( array() ); - remove_filter( 'networks_pre_query', array( __CLASS__, 'filter_networks_pre_query' ), 10, 2 ); + remove_filter( 'networks_pre_query', array( __CLASS__, 'filter_networks_pre_query' ) ); // Make sure no queries were executed. $this->assertSame( $num_queries, get_num_queries() ); diff --git a/tests/phpunit/tests/multisite/wpSiteQuery.php b/tests/phpunit/tests/multisite/wpSiteQuery.php index 0bca5818fe863..f00414bce591d 100644 --- a/tests/phpunit/tests/multisite/wpSiteQuery.php +++ b/tests/phpunit/tests/multisite/wpSiteQuery.php @@ -1122,7 +1122,7 @@ public function test_sites_pre_query_filter_should_bypass_database_query() { $q = new WP_Site_Query(); $results = $q->query( array() ); - remove_filter( 'sites_pre_query', array( __CLASS__, 'filter_sites_pre_query' ), 10, 2 ); + remove_filter( 'sites_pre_query', array( __CLASS__, 'filter_sites_pre_query' ) ); // Make sure no queries were executed. $this->assertSame( $num_queries, get_num_queries() ); diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php index 842502a971cba..b5f20dcf6be51 100644 --- a/tests/phpunit/tests/post.php +++ b/tests/phpunit/tests/post.php @@ -522,7 +522,7 @@ public function test_pre_wp_unique_post_slug_filter() { $post = get_post( $post_id ); $this->assertSame( 'override-slug-' . $post->post_type, $post->post_name ); - remove_filter( 'pre_wp_unique_post_slug', array( $this, 'filter_pre_wp_unique_post_slug' ), 10, 6 ); + remove_filter( 'pre_wp_unique_post_slug', array( $this, 'filter_pre_wp_unique_post_slug' ) ); } public function filter_pre_wp_unique_post_slug( $override_slug, $slug, $post_id, $post_status, $post_type, $post_parent ) { diff --git a/tests/phpunit/tests/post/attachments.php b/tests/phpunit/tests/post/attachments.php index 193b5996332b8..3999b444223b7 100644 --- a/tests/phpunit/tests/post/attachments.php +++ b/tests/phpunit/tests/post/attachments.php @@ -471,7 +471,7 @@ public function test_wp_attachment_is_default() { $this->assertFalse( wp_attachment_is( 'video', $attachment_id ) ); if ( is_multisite() ) { - remove_filter( 'upload_mimes', array( $this, 'allow_psd_mime_type' ), 10, 2 ); + remove_filter( 'upload_mimes', array( $this, 'allow_psd_mime_type' ) ); } } diff --git a/tests/phpunit/tests/post/nav-menu.php b/tests/phpunit/tests/post/nav-menu.php index 5ee9fb5f57097..06afc36d02e7c 100644 --- a/tests/phpunit/tests/post/nav-menu.php +++ b/tests/phpunit/tests/post/nav-menu.php @@ -748,19 +748,19 @@ public function test_wp_nav_menu_filters_are_passed_args_object() { * Remove test filters. */ // In function. - remove_filter( 'pre_wp_nav_menu', array( $this, 'confirm_second_param_args_object' ), 10, 2 ); - remove_filter( 'wp_nav_menu_objects', array( $this, 'confirm_second_param_args_object' ), 10, 2 ); - remove_filter( 'wp_nav_menu_items', array( $this, 'confirm_second_param_args_object' ), 10, 2 ); + remove_filter( 'pre_wp_nav_menu', array( $this, 'confirm_second_param_args_object' ) ); + remove_filter( 'wp_nav_menu_objects', array( $this, 'confirm_second_param_args_object' ) ); + remove_filter( 'wp_nav_menu_items', array( $this, 'confirm_second_param_args_object' ) ); // In walker. remove_filter( 'nav_menu_item_args', array( $this, 'confirm_nav_menu_item_args_object' ) ); - remove_filter( 'nav_menu_css_class', array( $this, 'confirm_third_param_args_object' ), 10, 3 ); - remove_filter( 'nav_menu_item_id', array( $this, 'confirm_third_param_args_object' ), 10, 3 ); - remove_filter( 'nav_menu_link_attributes', array( $this, 'confirm_third_param_args_object' ), 10, 3 ); - remove_filter( 'nav_menu_item_title', array( $this, 'confirm_third_param_args_object' ), 10, 3 ); + remove_filter( 'nav_menu_css_class', array( $this, 'confirm_third_param_args_object' ) ); + remove_filter( 'nav_menu_item_id', array( $this, 'confirm_third_param_args_object' ) ); + remove_filter( 'nav_menu_link_attributes', array( $this, 'confirm_third_param_args_object' ) ); + remove_filter( 'nav_menu_item_title', array( $this, 'confirm_third_param_args_object' ) ); - remove_filter( 'walker_nav_menu_start_el', array( $this, 'confirm_forth_param_args_object' ), 10, 4 ); + remove_filter( 'walker_nav_menu_start_el', array( $this, 'confirm_forth_param_args_object' ) ); } /** diff --git a/tests/phpunit/tests/post/wpInsertPost.php b/tests/phpunit/tests/post/wpInsertPost.php index 12279848346d2..f7b3478b26179 100644 --- a/tests/phpunit/tests/post/wpInsertPost.php +++ b/tests/phpunit/tests/post/wpInsertPost.php @@ -1350,7 +1350,7 @@ public function test_wp_untrash_post_status_filter_restores_post_to_correct_stat wp_trash_post( $page_id ); wp_untrash_post( $page_id ); - remove_filter( 'wp_untrash_post_status', 'wp_untrash_post_set_previous_status', 10, 3 ); + remove_filter( 'wp_untrash_post_status', 'wp_untrash_post_set_previous_status' ); $this->assertSame( $post_status, get_post( $page_id )->post_status ); } diff --git a/tests/phpunit/tests/rest-api/rest-comments-controller.php b/tests/phpunit/tests/rest-api/rest-comments-controller.php index 7162b278839d5..97c953f6d386e 100644 --- a/tests/phpunit/tests/rest-api/rest-comments-controller.php +++ b/tests/phpunit/tests/rest-api/rest-comments-controller.php @@ -2283,7 +2283,7 @@ public function test_allow_anonymous_comments_null() { $response = rest_get_server()->dispatch( $request ); - remove_filter( 'rest_allow_anonymous_comments', array( $this, 'anonymous_comments_callback_null' ), 10, 2 ); + remove_filter( 'rest_allow_anonymous_comments', array( $this, 'anonymous_comments_callback_null' ) ); $this->assertErrorResponse( 'rest_comment_login_required', $response, 401 ); } @@ -3024,7 +3024,7 @@ public function test_update_comment_is_wp_error() { $request->set_body( wp_json_encode( $params ) ); $response = rest_get_server()->dispatch( $request ); - remove_filter( 'wp_update_comment_data', array( $this, '_wp_update_comment_data_filter' ), 10, 3 ); + remove_filter( 'wp_update_comment_data', array( $this, '_wp_update_comment_data_filter' ) ); $this->assertErrorResponse( 'rest_comment_failed_edit', $response, 500 ); } diff --git a/tests/phpunit/tests/rest-api/rest-posts-controller.php b/tests/phpunit/tests/rest-api/rest-posts-controller.php index 212ddde70dd83..1a27dc17a9688 100644 --- a/tests/phpunit/tests/rest-api/rest-posts-controller.php +++ b/tests/phpunit/tests/rest-api/rest-posts-controller.php @@ -3720,7 +3720,7 @@ public function test_create_post_with_categories_that_cannot_be_assigned_by_curr add_filter( 'map_meta_cap', array( $this, 'revoke_assign_term' ), 10, 4 ); $response = rest_get_server()->dispatch( $request ); - remove_filter( 'map_meta_cap', array( $this, 'revoke_assign_term' ), 10, 4 ); + remove_filter( 'map_meta_cap', array( $this, 'revoke_assign_term' ) ); $this->assertErrorResponse( 'rest_cannot_assign_term', $response, 403 ); } @@ -4454,7 +4454,7 @@ public function test_update_post_with_categories_that_cannot_be_assigned_by_curr add_filter( 'map_meta_cap', array( $this, 'revoke_assign_term' ), 10, 4 ); $response = rest_get_server()->dispatch( $request ); - remove_filter( 'map_meta_cap', array( $this, 'revoke_assign_term' ), 10, 4 ); + remove_filter( 'map_meta_cap', array( $this, 'revoke_assign_term' ) ); $this->assertErrorResponse( 'rest_cannot_assign_term', $response, 403 ); } diff --git a/tests/phpunit/tests/rest-api/rest-tags-controller.php b/tests/phpunit/tests/rest-api/rest-tags-controller.php index 3b23135c93706..c12ee3b0c58e6 100644 --- a/tests/phpunit/tests/rest-api/rest-tags-controller.php +++ b/tests/phpunit/tests/rest-api/rest-tags-controller.php @@ -988,7 +988,7 @@ public function test_update_item_with_edit_term_cap_granted() { add_filter( 'map_meta_cap', array( $this, 'grant_edit_term' ), 10, 2 ); $response = rest_get_server()->dispatch( $request ); - remove_filter( 'user_has_cap', array( $this, 'grant_edit_term' ), 10, 2 ); + remove_filter( 'user_has_cap', array( $this, 'grant_edit_term' ) ); $this->assertSame( 200, $response->get_status() ); $data = $response->get_data(); @@ -1015,7 +1015,7 @@ public function test_update_item_with_edit_term_cap_revoked() { add_filter( 'map_meta_cap', array( $this, 'revoke_edit_term' ), 10, 2 ); $response = rest_get_server()->dispatch( $request ); - remove_filter( 'user_has_cap', array( $this, 'revoke_edit_term' ), 10, 2 ); + remove_filter( 'user_has_cap', array( $this, 'revoke_edit_term' ) ); $this->assertErrorResponse( 'rest_cannot_update', $response, 403 ); } @@ -1213,7 +1213,7 @@ public function test_delete_item_with_delete_term_cap_granted() { add_filter( 'map_meta_cap', array( $this, 'grant_delete_term' ), 10, 2 ); $response = rest_get_server()->dispatch( $request ); - remove_filter( 'map_meta_cap', array( $this, 'grant_delete_term' ), 10, 2 ); + remove_filter( 'map_meta_cap', array( $this, 'grant_delete_term' ) ); $this->assertSame( 200, $response->get_status() ); $data = $response->get_data(); @@ -1241,7 +1241,7 @@ public function test_delete_item_with_delete_term_cap_revoked() { add_filter( 'map_meta_cap', array( $this, 'revoke_delete_term' ), 10, 2 ); $response = rest_get_server()->dispatch( $request ); - remove_filter( 'map_meta_cap', array( $this, 'revoke_delete_term' ), 10, 2 ); + remove_filter( 'map_meta_cap', array( $this, 'revoke_delete_term' ) ); $this->assertErrorResponse( 'rest_cannot_delete', $response, 403 ); } diff --git a/tests/phpunit/tests/shortcode.php b/tests/phpunit/tests/shortcode.php index 7467d1ed7e6a3..0e6566a636e36 100644 --- a/tests/phpunit/tests/shortcode.php +++ b/tests/phpunit/tests/shortcode.php @@ -500,7 +500,7 @@ public function test_shortcode_atts_filter_passes_original_arguments() { ); $this->assertSame( array( 'foo' => 'foo1' ), $this->filter_atts_atts ); - remove_filter( 'shortcode_atts_bartag', array( $this, 'filter_atts' ), 10, 3 ); + remove_filter( 'shortcode_atts_bartag', array( $this, 'filter_atts' ) ); } public function test_shortcode_atts_filtering() { @@ -513,7 +513,7 @@ public function test_shortcode_atts_filtering() { $out = do_shortcode( '[bartag foo="foo2" /]' ); $this->assertSame( 'foo = foo2', $out ); - remove_filter( 'shortcode_atts_bartag', array( $this, 'filter_atts2' ), 10, 3 ); + remove_filter( 'shortcode_atts_bartag', array( $this, 'filter_atts2' ) ); } /** @@ -858,7 +858,7 @@ public function test_pre_do_shortcode_tag() { $result_atts = do_shortcode( "[{$str} a='b' c='d']" ); $this->assertSame( wp_json_encode( $arr ), $result_atts ); - remove_filter( 'pre_do_shortcode_tag', array( $this, 'filter_pre_do_shortcode_tag_attr' ), 12, 4 ); + remove_filter( 'pre_do_shortcode_tag', array( $this, 'filter_pre_do_shortcode_tag_attr' ), 12 ); remove_filter( 'pre_do_shortcode_tag', array( $this, 'filter_pre_do_shortcode_tag_p11' ), 11 ); remove_filter( 'pre_do_shortcode_tag', array( $this, 'filter_pre_do_shortcode_tag_bar' ) ); remove_shortcode( $str ); diff --git a/tests/phpunit/tests/term/query.php b/tests/phpunit/tests/term/query.php index f4a0a4cc5549f..c90b899e1a607 100644 --- a/tests/phpunit/tests/term/query.php +++ b/tests/phpunit/tests/term/query.php @@ -959,7 +959,7 @@ public function test_terms_pre_query_filter_should_bypass_database_query() { ) ); - remove_filter( 'terms_pre_query', array( __CLASS__, 'filter_terms_pre_query' ), 10, 2 ); + remove_filter( 'terms_pre_query', array( __CLASS__, 'filter_terms_pre_query' ) ); // Make sure no queries were executed. $this->assertSame( $num_queries, get_num_queries() ); diff --git a/tests/phpunit/tests/term/wpGetObjectTerms.php b/tests/phpunit/tests/term/wpGetObjectTerms.php index a8483f8a770a2..31c7bba7ddae5 100644 --- a/tests/phpunit/tests/term/wpGetObjectTerms.php +++ b/tests/phpunit/tests/term/wpGetObjectTerms.php @@ -127,7 +127,7 @@ public function test_taxonomies_passed_to_wp_get_object_terms_filter_should_be_q add_filter( 'wp_get_object_terms', array( $this, 'wp_get_object_terms_callback' ), 10, 3 ); $terms = wp_get_object_terms( 1, array( 'wptests_tax', 'wptests_tax_2' ) ); - remove_filter( 'wp_get_object_terms', array( $this, 'wp_get_object_terms_callback' ), 10, 3 ); + remove_filter( 'wp_get_object_terms', array( $this, 'wp_get_object_terms_callback' ) ); $this->assertSame( "'wptests_tax', 'wptests_tax_2'", $this->taxonomies ); } diff --git a/tests/phpunit/tests/term/wpInsertTerm.php b/tests/phpunit/tests/term/wpInsertTerm.php index 0bf95b9a10279..39754652e3f46 100644 --- a/tests/phpunit/tests/term/wpInsertTerm.php +++ b/tests/phpunit/tests/term/wpInsertTerm.php @@ -40,7 +40,7 @@ public function test_wp_insert_delete_term() { // Now delete it. add_filter( 'delete_term', array( $this, 'deleted_term_cb' ), 10, 5 ); $this->assertTrue( wp_delete_term( $t['term_id'], $taxonomy ) ); - remove_filter( 'delete_term', array( $this, 'deleted_term_cb' ), 10, 5 ); + remove_filter( 'delete_term', array( $this, 'deleted_term_cb' ) ); $this->assertNull( term_exists( $term ) ); $this->assertNull( term_exists( $t['term_id'] ) ); $this->assertSame( $initial_count, wp_count_terms( array( 'taxonomy' => $taxonomy ) ) ); diff --git a/tests/phpunit/tests/user/capabilities.php b/tests/phpunit/tests/user/capabilities.php index b92b0db231ecb..333562ae14f36 100644 --- a/tests/phpunit/tests/user/capabilities.php +++ b/tests/phpunit/tests/user/capabilities.php @@ -669,7 +669,7 @@ public function test_do_not_allow_is_denied_for_all_roles() { // Test adding the cap via a filter. add_filter( 'user_has_cap', array( $this, 'grant_do_not_allow' ), 10, 4 ); $has_cap = $user->has_cap( 'do_not_allow' ); - remove_filter( 'user_has_cap', array( $this, 'grant_do_not_allow' ), 10, 4 ); + remove_filter( 'user_has_cap', array( $this, 'grant_do_not_allow' ) ); $this->assertFalse( $has_cap, "User with the {$role} role should not have the do_not_allow capability" ); if ( 'anonymous' === $role ) { @@ -700,7 +700,7 @@ public function test_do_not_allow_is_denied_for_super_admins() { // Test adding the cap via a filter. add_filter( 'user_has_cap', array( $this, 'grant_do_not_allow' ), 10, 4 ); $has_cap = self::$super_admin->has_cap( 'do_not_allow' ); - remove_filter( 'user_has_cap', array( $this, 'grant_do_not_allow' ), 10, 4 ); + remove_filter( 'user_has_cap', array( $this, 'grant_do_not_allow' ) ); $this->assertFalse( $has_cap, 'Super admins should not have the do_not_allow capability' ); } diff --git a/tests/phpunit/tests/user/query.php b/tests/phpunit/tests/user/query.php index 5978f4bf55e58..518511c819169 100644 --- a/tests/phpunit/tests/user/query.php +++ b/tests/phpunit/tests/user/query.php @@ -1720,7 +1720,7 @@ public function test_users_pre_query_filter_should_bypass_database_query() { ) ); - remove_filter( 'users_pre_query', array( __CLASS__, 'filter_users_pre_query' ), 10, 2 ); + remove_filter( 'users_pre_query', array( __CLASS__, 'filter_users_pre_query' ) ); // Make sure no queries were executed. $this->assertSame( $num_queries, get_num_queries() ); diff --git a/tests/phpunit/tests/xmlrpc/wp/getPages.php b/tests/phpunit/tests/xmlrpc/wp/getPages.php index 9e120c87cc11d..1d7297e37bff9 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getPages.php +++ b/tests/phpunit/tests/xmlrpc/wp/getPages.php @@ -86,6 +86,6 @@ public function test_semi_capable_user() { } $this->assertFalse( $found_incapable ); - remove_filter( 'map_meta_cap', array( $this, 'remove_editor_edit_page_cap' ), 10, 4 ); + remove_filter( 'map_meta_cap', array( $this, 'remove_editor_edit_page_cap' ) ); } }