Coding Standards: Add visibility to methods in tests/phpunit/tests/.

Adds a `public` visibility to test fixtures, tests, data providers, and callbacks methods. This continues the previous efforts to make sure visibility is declared on all methods. 

Note: This will be enforced by WPCS 3.0.0.

Follow-up to [51919], [52009], [52010].

Props jrf.
See #56791.

git-svn-id: https://develop.svn.wordpress.org/trunk@54889 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2022-11-29 12:32:37 +00:00
parent 5cb17e222d
commit 8f86cdb2e0
21 changed files with 116 additions and 116 deletions

View File

@ -10,7 +10,7 @@ class Tests_Admin_wpCommentsListTable extends WP_UnitTestCase {
*/
protected $table;
function set_up() {
public function set_up() {
parent::set_up();
$this->table = _get_list_table( 'WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
}

View File

@ -12,7 +12,7 @@ class Tests_Admin_wpPostCommentsListTable extends WP_UnitTestCase {
*/
protected $table;
function set_up() {
public function set_up() {
parent::set_up();
$this->table = _get_list_table( 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-post-comments' ) );
}

View File

@ -14,7 +14,7 @@ class Tests_Admin_wpPostsListTable extends WP_UnitTestCase {
*/
protected $table;
function set_up() {
public function set_up() {
parent::set_up();
$this->table = _get_list_table( 'WP_Posts_List_Table', array( 'screen' => 'edit-page' ) );
}
@ -79,7 +79,7 @@ class Tests_Admin_wpPostsListTable extends WP_UnitTestCase {
* @covers WP_Posts_List_Table::display_rows
* @covers WP_Posts_List_Table::set_hierarchical_display
*/
function test_list_hierarchical_pages_first_page() {
public function test_list_hierarchical_pages_first_page() {
$this->_test_list_hierarchical_page(
array(
'paged' => 1,
@ -98,7 +98,7 @@ class Tests_Admin_wpPostsListTable extends WP_UnitTestCase {
* @covers WP_Posts_List_Table::display_rows
* @covers WP_Posts_List_Table::set_hierarchical_display
*/
function test_list_hierarchical_pages_second_page() {
public function test_list_hierarchical_pages_second_page() {
$this->_test_list_hierarchical_page(
array(
'paged' => 2,
@ -118,7 +118,7 @@ class Tests_Admin_wpPostsListTable extends WP_UnitTestCase {
* @covers WP_Posts_List_Table::display_rows
* @covers WP_Posts_List_Table::set_hierarchical_display
*/
function test_search_hierarchical_pages_first_page() {
public function test_search_hierarchical_pages_first_page() {
$this->_test_list_hierarchical_page(
array(
'paged' => 1,
@ -138,7 +138,7 @@ class Tests_Admin_wpPostsListTable extends WP_UnitTestCase {
* @covers WP_Posts_List_Table::display_rows
* @covers WP_Posts_List_Table::set_hierarchical_display
*/
function test_search_hierarchical_pages_second_page() {
public function test_search_hierarchical_pages_second_page() {
$this->_test_list_hierarchical_page(
array(
'paged' => 2,
@ -158,7 +158,7 @@ class Tests_Admin_wpPostsListTable extends WP_UnitTestCase {
* @covers WP_Posts_List_Table::display_rows
* @covers WP_Posts_List_Table::set_hierarchical_display
*/
function test_grandchildren_hierarchical_pages_first_page() {
public function test_grandchildren_hierarchical_pages_first_page() {
// Page 6 is the first page with grandchildren.
$this->_test_list_hierarchical_page(
array(
@ -180,7 +180,7 @@ class Tests_Admin_wpPostsListTable extends WP_UnitTestCase {
* @covers WP_Posts_List_Table::display_rows
* @covers WP_Posts_List_Table::set_hierarchical_display
*/
function test_grandchildren_hierarchical_pages_second_page() {
public function test_grandchildren_hierarchical_pages_second_page() {
// Page 7 is the second page with grandchildren.
$this->_test_list_hierarchical_page(
array(
@ -260,7 +260,7 @@ class Tests_Admin_wpPostsListTable extends WP_UnitTestCase {
*
* @covers WP_Posts_List_Table::extra_tablenav
*/
function test_filter_button_should_not_be_shown_if_there_are_no_posts() {
public function test_filter_button_should_not_be_shown_if_there_are_no_posts() {
// Set post type to a non-existent one.
$this->table->screen->post_type = 'foo';
@ -276,7 +276,7 @@ class Tests_Admin_wpPostsListTable extends WP_UnitTestCase {
*
* @covers WP_Posts_List_Table::extra_tablenav
*/
function test_months_dropdown_should_not_be_shown_if_there_are_no_posts() {
public function test_months_dropdown_should_not_be_shown_if_there_are_no_posts() {
// Set post type to a non-existent one.
$this->table->screen->post_type = 'foo';
@ -292,7 +292,7 @@ class Tests_Admin_wpPostsListTable extends WP_UnitTestCase {
*
* @covers WP_Posts_List_Table::extra_tablenav
*/
function test_category_dropdown_should_not_be_shown_if_there_are_no_posts() {
public function test_category_dropdown_should_not_be_shown_if_there_are_no_posts() {
// Set post type to a non-existent one.
$this->table->screen->post_type = 'foo';

View File

@ -10,12 +10,12 @@ class Test_Block_Supports_Border extends WP_UnitTestCase {
*/
private $test_block_name;
function set_up() {
public function set_up() {
parent::set_up();
$this->test_block_name = null;
}
function tear_down() {
public function tear_down() {
unregister_block_type( $this->test_block_name );
$this->test_block_name = null;
parent::set_up();
@ -24,7 +24,7 @@ class Test_Block_Supports_Border extends WP_UnitTestCase {
/**
* @ticket 55505
*/
function test_border_color_slug_with_numbers_is_kebab_cased_properly() {
public function test_border_color_slug_with_numbers_is_kebab_cased_properly() {
$this->test_block_name = 'test/border-color-slug-with-numbers-is-kebab-cased-properly';
register_block_type(
$this->test_block_name,
@ -73,7 +73,7 @@ class Test_Block_Supports_Border extends WP_UnitTestCase {
/**
* @ticket 55505
*/
function test_border_with_skipped_serialization_block_supports() {
public function test_border_with_skipped_serialization_block_supports() {
$this->test_block_name = 'test/border-with-skipped-serialization-block-supports';
register_block_type(
$this->test_block_name,
@ -117,7 +117,7 @@ class Test_Block_Supports_Border extends WP_UnitTestCase {
/**
* @ticket 55505
*/
function test_radius_with_individual_skipped_serialization_block_supports() {
public function test_radius_with_individual_skipped_serialization_block_supports() {
$this->test_block_name = 'test/radius-with-individual-skipped-serialization-block-supports';
register_block_type(
$this->test_block_name,

View File

@ -10,12 +10,12 @@ class Tests_Block_Supports_Colors extends WP_UnitTestCase {
*/
private $test_block_name;
function set_up() {
public function set_up() {
parent::set_up();
$this->test_block_name = null;
}
function tear_down() {
public function tear_down() {
unregister_block_type( $this->test_block_name );
$this->test_block_name = null;
parent::set_up();
@ -24,7 +24,7 @@ class Tests_Block_Supports_Colors extends WP_UnitTestCase {
/**
* @ticket 54337
*/
function test_color_slugs_with_numbers_are_kebab_cased_properly() {
public function test_color_slugs_with_numbers_are_kebab_cased_properly() {
$this->test_block_name = 'test/color-slug-with-numbers';
register_block_type(
$this->test_block_name,
@ -68,7 +68,7 @@ class Tests_Block_Supports_Colors extends WP_UnitTestCase {
/**
* @ticket 55505
*/
function test_color_with_skipped_serialization_block_supports() {
public function test_color_with_skipped_serialization_block_supports() {
$this->test_block_name = 'test/color-with-skipped-serialization-block-supports';
register_block_type(
$this->test_block_name,
@ -109,7 +109,7 @@ class Tests_Block_Supports_Colors extends WP_UnitTestCase {
/**
* @ticket 55505
*/
function test_gradient_with_individual_skipped_serialization_block_supports() {
public function test_gradient_with_individual_skipped_serialization_block_supports() {
$this->test_block_name = 'test/gradient-with-individual-skipped-serialization-block-support';
register_block_type(
$this->test_block_name,

View File

@ -32,7 +32,7 @@ class Test_Block_Supports_Layout extends WP_UnitTestCase {
*/
private $orig_theme_dir;
function set_up() {
public function set_up() {
parent::set_up();
$this->theme_root = realpath( DIR_TESTDATA . '/themedir1' );
$this->orig_theme_dir = $GLOBALS['wp_theme_directories'];
@ -50,7 +50,7 @@ class Test_Block_Supports_Layout extends WP_UnitTestCase {
unset( $GLOBALS['wp_themes'] );
}
function tear_down() {
public function tear_down() {
$GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
// Clear up the filters to modify the theme root.
@ -63,14 +63,14 @@ class Test_Block_Supports_Layout extends WP_UnitTestCase {
parent::tear_down();
}
function filter_set_theme_root() {
public function filter_set_theme_root() {
return $this->theme_root;
}
/**
* @ticket 55505
*/
function test_outer_container_not_restored_for_non_aligned_image_block_with_non_themejson_theme() {
public function test_outer_container_not_restored_for_non_aligned_image_block_with_non_themejson_theme() {
// The "default" theme doesn't have theme.json support.
switch_theme( 'default' );
$block = array(
@ -86,7 +86,7 @@ class Test_Block_Supports_Layout extends WP_UnitTestCase {
/**
* @ticket 55505
*/
function test_outer_container_restored_for_aligned_image_block_with_non_themejson_theme() {
public function test_outer_container_restored_for_aligned_image_block_with_non_themejson_theme() {
// The "default" theme doesn't have theme.json support.
switch_theme( 'default' );
$block = array(
@ -107,7 +107,7 @@ class Test_Block_Supports_Layout extends WP_UnitTestCase {
* @param string $block_image_html The block image HTML passed to `wp_restore_image_outer_container`.
* @param string $expected The expected block image HTML.
*/
function test_additional_styles_moved_to_restored_outer_container_for_aligned_image_block_with_non_themejson_theme( $block_image_html, $expected ) {
public function test_additional_styles_moved_to_restored_outer_container_for_aligned_image_block_with_non_themejson_theme( $block_image_html, $expected ) {
// The "default" theme doesn't have theme.json support.
switch_theme( 'default' );
$block = array(
@ -160,7 +160,7 @@ class Test_Block_Supports_Layout extends WP_UnitTestCase {
/**
* @ticket 55505
*/
function test_outer_container_not_restored_for_aligned_image_block_with_themejson_theme() {
public function test_outer_container_not_restored_for_aligned_image_block_with_themejson_theme() {
switch_theme( 'block-theme' );
$block = array(
'blockName' => 'core/image',

View File

@ -10,12 +10,12 @@ class Test_Block_Supports_Spacing extends WP_UnitTestCase {
*/
private $test_block_name;
function set_up() {
public function set_up() {
parent::set_up();
$this->test_block_name = null;
}
function tear_down() {
public function tear_down() {
unregister_block_type( $this->test_block_name );
$this->test_block_name = null;
parent::set_up();
@ -24,7 +24,7 @@ class Test_Block_Supports_Spacing extends WP_UnitTestCase {
/**
* @ticket 55505
*/
function test_spacing_style_is_applied() {
public function test_spacing_style_is_applied() {
$this->test_block_name = 'test/spacing-style-is-applied';
register_block_type(
$this->test_block_name,
@ -72,7 +72,7 @@ class Test_Block_Supports_Spacing extends WP_UnitTestCase {
/**
* @ticket 55505
*/
function test_spacing_with_skipped_serialization_block_supports() {
public function test_spacing_with_skipped_serialization_block_supports() {
$this->test_block_name = 'test/spacing-with-skipped-serialization-block-supports';
register_block_type(
$this->test_block_name,
@ -119,7 +119,7 @@ class Test_Block_Supports_Spacing extends WP_UnitTestCase {
/**
* @ticket 55505
*/
function test_margin_with_individual_skipped_serialization_block_supports() {
public function test_margin_with_individual_skipped_serialization_block_supports() {
$this->test_block_name = 'test/margin-with-individual-skipped-serialization-block-supports';
register_block_type(
$this->test_block_name,

View File

@ -23,7 +23,7 @@ class Tests_Block_Supports_Typography extends WP_UnitTestCase {
*/
private $orig_theme_dir;
function set_up() {
public function set_up() {
parent::set_up();
$this->test_block_name = null;
@ -48,7 +48,7 @@ class Tests_Block_Supports_Typography extends WP_UnitTestCase {
/**
* Unregisters block type after each test.
*/
function tear_down() {
public function tear_down() {
// Restores the original theme directory setup.
$GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
wp_clean_themes_cache();
@ -68,7 +68,7 @@ class Tests_Block_Supports_Typography extends WP_UnitTestCase {
*
* @covers ::wp_apply_typography_support
*/
function test_should_kebab_case_font_size_slug_with_numbers() {
public function test_should_kebab_case_font_size_slug_with_numbers() {
$this->test_block_name = 'test/font-size-slug-with-numbers';
register_block_type(
$this->test_block_name,
@ -104,7 +104,7 @@ class Tests_Block_Supports_Typography extends WP_UnitTestCase {
*
* @covers ::wp_apply_typography_support
*/
function test_should_generate_font_family_with_legacy_inline_styles_using_a_value() {
public function test_should_generate_font_family_with_legacy_inline_styles_using_a_value() {
$this->test_block_name = 'test/font-family-with-inline-styles-using-value';
register_block_type(
$this->test_block_name,
@ -139,7 +139,7 @@ class Tests_Block_Supports_Typography extends WP_UnitTestCase {
*
* @covers ::wp_apply_typography_support
*/
function test_should_skip_serialization_for_typography_block_supports() {
public function test_should_skip_serialization_for_typography_block_supports() {
$this->test_block_name = 'test/typography-with-skipped-serialization-block-supports';
register_block_type(
$this->test_block_name,
@ -187,7 +187,7 @@ class Tests_Block_Supports_Typography extends WP_UnitTestCase {
*
* @covers ::wp_apply_typography_support
*/
function test_should_skip_serialization_for_letter_spacing_block_supports() {
public function test_should_skip_serialization_for_letter_spacing_block_supports() {
$this->test_block_name = 'test/letter-spacing-with-individual-skipped-serialization-block-supports';
register_block_type(
$this->test_block_name,
@ -225,7 +225,7 @@ class Tests_Block_Supports_Typography extends WP_UnitTestCase {
*
* @covers ::wp_apply_typography_support
*/
function test_should_generate_css_var_for_font_family_with_legacy_inline_styles() {
public function test_should_generate_css_var_for_font_family_with_legacy_inline_styles() {
$this->test_block_name = 'test/font-family-with-inline-styles-using-css-var';
register_block_type(
$this->test_block_name,
@ -260,7 +260,7 @@ class Tests_Block_Supports_Typography extends WP_UnitTestCase {
*
* @covers ::wp_apply_typography_support
*/
function test_should_generate_classname_for_font_family() {
public function test_should_generate_classname_for_font_family() {
$this->test_block_name = 'test/font-family-with-class';
register_block_type(
$this->test_block_name,
@ -308,7 +308,7 @@ class Tests_Block_Supports_Typography extends WP_UnitTestCase {
* @param bool $should_use_fluid_typography An override to switch fluid typography "on". Can be used for unit testing.
* @param string $expected_output Expected output.
*/
function test_wp_get_typography_font_size_value( $font_size_preset, $should_use_fluid_typography, $expected_output ) {
public function test_wp_get_typography_font_size_value( $font_size_preset, $should_use_fluid_typography, $expected_output ) {
$actual = wp_get_typography_font_size_value( $font_size_preset, $should_use_fluid_typography );
$this->assertSame( $expected_output, $actual );

View File

@ -131,7 +131,7 @@ class Tests_Block_Template_Utils extends WP_UnitTestCase {
*
* @covers ::_build_block_template_result_from_post
*/
function test_build_block_template_result_from_post_with_child_theme() {
public function test_build_block_template_result_from_post_with_child_theme() {
switch_theme( 'block-theme-child' );
$template = _build_block_template_result_from_post(
@ -142,7 +142,7 @@ class Tests_Block_Template_Utils extends WP_UnitTestCase {
$this->assertSame( self::TEST_THEME, $template->theme );
}
function test_build_block_template_result_from_file() {
public function test_build_block_template_result_from_file() {
$template = _build_block_template_result_from_file(
array(
'slug' => 'single',
@ -188,7 +188,7 @@ class Tests_Block_Template_Utils extends WP_UnitTestCase {
*
* @covers ::_build_block_template_result_from_file
*/
function test_build_block_template_result_from_file_with_child_theme() {
public function test_build_block_template_result_from_file_with_child_theme() {
switch_theme( 'block-theme-child' );
$template = _build_block_template_result_from_file(
@ -203,7 +203,7 @@ class Tests_Block_Template_Utils extends WP_UnitTestCase {
$this->assertSame( self::TEST_THEME, $template->theme );
}
function test_inject_theme_attribute_in_block_template_content() {
public function test_inject_theme_attribute_in_block_template_content() {
$theme = get_stylesheet();
$content_without_theme_attribute = '<!-- wp:template-part {"slug":"header","align":"full", "tagName":"header","className":"site-header"} /-->';
$template_content = _inject_theme_attribute_in_block_template_content(
@ -249,11 +249,11 @@ class Tests_Block_Template_Utils extends WP_UnitTestCase {
*
* @dataProvider data_remove_theme_attribute_in_block_template_content
*/
function test_remove_theme_attribute_in_block_template_content( $template_content, $expected ) {
public function test_remove_theme_attribute_in_block_template_content( $template_content, $expected ) {
$this->assertSame( $expected, _remove_theme_attribute_in_block_template_content( $template_content ) );
}
function data_remove_theme_attribute_in_block_template_content() {
public function data_remove_theme_attribute_in_block_template_content() {
return array(
array(
'<!-- wp:template-part {"slug":"header","theme":"tt1-blocks","align":"full","tagName":"header","className":"site-header"} /-->',
@ -279,7 +279,7 @@ class Tests_Block_Template_Utils extends WP_UnitTestCase {
/**
* Should retrieve the template from the theme files.
*/
function test_get_block_template_from_file() {
public function test_get_block_template_from_file() {
$id = get_stylesheet() . '//' . 'index';
$template = get_block_template( $id, 'wp_template' );
$this->assertSame( $id, $template->id );
@ -329,7 +329,7 @@ class Tests_Block_Template_Utils extends WP_UnitTestCase {
/**
* Should flatten nested blocks
*/
function test_flatten_blocks() {
public function test_flatten_blocks() {
$content_template_part_inside_group = '<!-- wp:group --><!-- wp:template-part {"slug":"header"} /--><!-- /wp:group -->';
$blocks = parse_blocks( $content_template_part_inside_group );
$actual = _flatten_blocks( $blocks );
@ -355,7 +355,7 @@ class Tests_Block_Template_Utils extends WP_UnitTestCase {
* @ticket 54448
* @requires extension zip
*/
function test_wp_generate_block_templates_export_file() {
public function test_wp_generate_block_templates_export_file() {
$filename = wp_generate_block_templates_export_file();
$this->assertFileExists( $filename, 'zip file is created at the specified path' );
$this->assertTrue( filesize( $filename ) > 0, 'zip file is larger than 0 bytes' );

View File

@ -28,7 +28,7 @@ class Tests_Block_Template extends WP_UnitTestCase {
parent::tear_down();
}
function test_page_home_block_template_takes_precedence_over_less_specific_block_templates() {
public function test_page_home_block_template_takes_precedence_over_less_specific_block_templates() {
global $_wp_current_template_content;
$type = 'page';
$templates = array(
@ -41,7 +41,7 @@ class Tests_Block_Template extends WP_UnitTestCase {
$this->assertStringEqualsFile( get_stylesheet_directory() . '/templates/page-home.html', $_wp_current_template_content );
}
function test_page_block_template_takes_precedence() {
public function test_page_block_template_takes_precedence() {
global $_wp_current_template_content;
$type = 'page';
$templates = array(
@ -54,7 +54,7 @@ class Tests_Block_Template extends WP_UnitTestCase {
$this->assertStringEqualsFile( get_stylesheet_directory() . '/templates/page.html', $_wp_current_template_content );
}
function test_block_template_takes_precedence_over_equally_specific_php_template() {
public function test_block_template_takes_precedence_over_equally_specific_php_template() {
global $_wp_current_template_content;
$type = 'index';
$templates = array(
@ -71,7 +71,7 @@ class Tests_Block_Template extends WP_UnitTestCase {
*
* Covers https://github.com/WordPress/gutenberg/pull/29026.
*/
function test_more_specific_php_template_takes_precedence_over_less_specific_block_template() {
public function test_more_specific_php_template_takes_precedence_over_less_specific_block_template() {
$page_id_template = 'page-1.php';
$page_id_template_path = get_stylesheet_directory() . '/' . $page_id_template;
$type = 'page';
@ -93,7 +93,7 @@ class Tests_Block_Template extends WP_UnitTestCase {
* Covers https://core.trac.wordpress.org/ticket/54515.
*
*/
function test_child_theme_php_template_takes_precedence_over_equally_specific_parent_theme_block_template() {
public function test_child_theme_php_template_takes_precedence_over_equally_specific_parent_theme_block_template() {
switch_theme( 'block-theme-child' );
$page_slug_template = 'page-home.php';
@ -108,7 +108,7 @@ class Tests_Block_Template extends WP_UnitTestCase {
$this->assertSame( $page_slug_template_path, $resolved_template_path );
}
function test_child_theme_block_template_takes_precedence_over_equally_specific_parent_theme_php_template() {
public function test_child_theme_block_template_takes_precedence_over_equally_specific_parent_theme_php_template() {
global $_wp_current_template_content;
switch_theme( 'block-theme-child' );

View File

@ -87,7 +87,7 @@ class Tests_Blocks_RenderReusableCommentTemplate extends WP_UnitTestCase {
* @ticket 55505
* @covers ::build_comment_query_vars_from_block
*/
function test_build_comment_query_vars_from_block_with_context() {
public function test_build_comment_query_vars_from_block_with_context() {
$parsed_blocks = parse_blocks(
'<!-- wp:comment-template --><!-- wp:comment-author-name /--><!-- wp:comment-content /--><!-- /wp:comment-template -->'
);
@ -118,7 +118,7 @@ class Tests_Blocks_RenderReusableCommentTemplate extends WP_UnitTestCase {
* @ticket 55567
* @covers ::build_comment_query_vars_from_block
*/
function test_build_comment_query_vars_from_block_with_context_no_pagination() {
public function test_build_comment_query_vars_from_block_with_context_no_pagination() {
update_option( 'page_comments', false );
$parsed_blocks = parse_blocks(
'<!-- wp:comment-template --><!-- wp:comment-author-name /--><!-- wp:comment-content /--><!-- /wp:comment-template -->'
@ -148,7 +148,7 @@ class Tests_Blocks_RenderReusableCommentTemplate extends WP_UnitTestCase {
* @ticket 55505
* @covers ::build_comment_query_vars_from_block
*/
function test_build_comment_query_vars_from_block_no_context() {
public function test_build_comment_query_vars_from_block_no_context() {
$parsed_blocks = parse_blocks(
'<!-- wp:comment-template --><!-- wp:comment-author-name /--><!-- wp:comment-content /--><!-- /wp:comment-template -->'
);
@ -178,7 +178,7 @@ class Tests_Blocks_RenderReusableCommentTemplate extends WP_UnitTestCase {
* @ticket 55658
* @covers ::build_comment_query_vars_from_block
*/
function test_build_comment_query_vars_from_block_pagination_with_no_comments() {
public function test_build_comment_query_vars_from_block_pagination_with_no_comments() {
$comments_per_page = get_option( 'comments_per_page' );
$default_comments_page = get_option( 'default_comments_page' );
@ -230,7 +230,7 @@ class Tests_Blocks_RenderReusableCommentTemplate extends WP_UnitTestCase {
* @ticket 55505
* @covers ::build_comment_query_vars_from_block
*/
function test_build_comment_query_vars_from_block_sets_cpage_var() {
public function test_build_comment_query_vars_from_block_sets_cpage_var() {
// This could be any number, we set a fixed one instead of a random for better performance.
$comment_query_max_num_pages = 5;
@ -267,7 +267,7 @@ class Tests_Blocks_RenderReusableCommentTemplate extends WP_UnitTestCase {
*
* @ticket 55567
*/
function test_rendering_comment_template() {
public function test_rendering_comment_template() {
$parsed_blocks = parse_blocks(
'<!-- wp:comment-template --><!-- wp:comment-author-name /--><!-- wp:comment-content /--><!-- /wp:comment-template -->'
);
@ -295,7 +295,7 @@ class Tests_Blocks_RenderReusableCommentTemplate extends WP_UnitTestCase {
*
* @ticket 55567
*/
function test_rendering_comment_template_nested() {
public function test_rendering_comment_template_nested() {
$first_level_ids = self::factory()->comment->create_post_comments(
self::$custom_post->ID,
2,
@ -396,7 +396,7 @@ END
*
* @ticket 55643
*/
function test_render_block_core_comment_content_converts_to_html() {
public function test_render_block_core_comment_content_converts_to_html() {
$comment_id = self::$comment_ids[0];
$new_content = "Paragraph One\n\nP2L1\nP2L2\n\nhttps://example.com/";
self::factory()->comment->update_object(
@ -430,7 +430,7 @@ END
* @ticket 55634
* @covers ::build_comment_query_vars_from_block
*/
function test_build_comment_query_vars_from_block_with_comment_preview() {
public function test_build_comment_query_vars_from_block_with_comment_preview() {
$parsed_blocks = parse_blocks(
'<!-- wp:comment-template --><!-- wp:comment-author-name /--><!-- wp:comment-content /--><!-- /wp:comment-template -->'
);
@ -471,7 +471,7 @@ END
*
* @ticket 55643
*/
function test_rendering_comment_template_unmoderated_preview() {
public function test_rendering_comment_template_unmoderated_preview() {
$parsed_blocks = parse_blocks(
'<!-- wp:comment-template --><!-- wp:comment-author-name /--><!-- wp:comment-content /--><!-- /wp:comment-template -->'
);

View File

@ -2069,7 +2069,7 @@ class Tests_Functions extends WP_UnitTestCase {
* @ticket 55505
* @covers ::wp_recursive_ksort
*/
function test_wp_recursive_ksort() {
public function test_wp_recursive_ksort() {
// Create an array to test.
$theme_json = array(
'version' => 1,

View File

@ -1647,14 +1647,14 @@ EOF;
* @param string $html A string of HTML to test.
* @param string $expected The expected result from KSES.
*/
function test_wp_kses_object_tag_allowed( $html, $expected ) {
public function test_wp_kses_object_tag_allowed( $html, $expected ) {
$this->assertSame( $expected, wp_kses_post( $html ) );
}
/**
* Data provider for test_wp_kses_object_tag_allowed().
*/
function data_wp_kses_object_tag_allowed() {
public function data_wp_kses_object_tag_allowed() {
return array(
'valid value for type' => array(
'<object type="application/pdf" data="https://example.org/foo.pdf" />',
@ -1757,7 +1757,7 @@ EOF;
* @param string $html A string of HTML to test.
* @param string $expected The expected result from KSES.
*/
function test_wp_kses_object_data_url_with_port_number_allowed( $html, $expected ) {
public function test_wp_kses_object_data_url_with_port_number_allowed( $html, $expected ) {
add_filter( 'upload_dir', array( $this, 'wp_kses_upload_dir_filter' ), 10, 2 );
$this->assertSame( $expected, wp_kses_post( $html ) );
}
@ -1765,7 +1765,7 @@ EOF;
/**
* Data provider for test_wp_kses_object_data_url_with_port_number_allowed().
*/
function data_wp_kses_object_data_url_with_port_number_allowed() {
public function data_wp_kses_object_data_url_with_port_number_allowed() {
return array(
'url with port number' => array(
'<object type="application/pdf" data="https://example.org:8888/cat/foo.pdf" />',
@ -1804,7 +1804,7 @@ EOF;
*
* @ticket 54261
*/
function test_wp_kses_object_added_in_html_filter() {
public function test_wp_kses_object_added_in_html_filter() {
$html = <<<HTML
<object type="application/pdf" data="https://wordpress.org/foo.pdf" />
<object type="application/x-shockwave-flash" data="https://wordpress.org/foo.swf">
@ -1821,7 +1821,7 @@ HTML;
$this->assertSame( $html, $filtered_html );
}
function filter_wp_kses_object_added_in_html_filter( $tags, $context ) {
public function filter_wp_kses_object_added_in_html_filter( $tags, $context ) {
if ( 'post' === $context ) {
$tags['object'] = array(
'type' => true,
@ -1848,14 +1848,14 @@ HTML;
* @param string $expected The expected result from KSES.
* @param array $allowed_html The allowed HTML to pass to KSES.
*/
function test_wp_kses_allowed_values_list( $html, $expected, $allowed_html ) {
public function test_wp_kses_allowed_values_list( $html, $expected, $allowed_html ) {
$this->assertSame( $expected, wp_kses( $html, $allowed_html ) );
}
/**
* Data provider for test_wp_kses_allowed_values_list().
*/
function data_wp_kses_allowed_values_list() {
public function data_wp_kses_allowed_values_list() {
$data = array(
'valid dir attribute value' => array(
'<p dir="ltr">foo</p>',
@ -1906,14 +1906,14 @@ HTML;
* @param string $expected The expected result from KSES.
* @param array $allowed_html The allowed HTML to pass to KSES.
*/
function test_wp_kses_required_attribute( $html, $expected, $allowed_html ) {
public function test_wp_kses_required_attribute( $html, $expected, $allowed_html ) {
$this->assertSame( $expected, wp_kses( $html, $allowed_html ) );
}
/**
* Data provider for test_wp_kses_required_attribute().
*/
function data_wp_kses_required_attribute() {
public function data_wp_kses_required_attribute() {
$data = array(
'valid dir attribute value' => array(
'<p dir="ltr">foo</p>', // Test HTML.

View File

@ -3477,7 +3477,7 @@ EOF;
*
* @param string $context
*/
function test_wp_get_loading_attr_default( $context ) {
public function test_wp_get_loading_attr_default( $context ) {
global $wp_query, $wp_the_query;
// Return 'lazy' by default.
@ -3515,7 +3515,7 @@ EOF;
}
}
function data_wp_get_loading_attr_default() {
public function data_wp_get_loading_attr_default() {
return array(
array( 'the_content' ),
array( 'the_post_thumbnail' ),
@ -3525,7 +3525,7 @@ EOF;
/**
* @ticket 53675
*/
function test_wp_omit_loading_attr_threshold_filter() {
public function test_wp_omit_loading_attr_threshold_filter() {
global $wp_query, $wp_the_query;
$wp_query = new WP_Query( array( 'post__in' => array( self::$post_ids['publish'] ) ) );
@ -3557,7 +3557,7 @@ EOF;
/**
* @ticket 53675
*/
function test_wp_filter_content_tags_with_wp_get_loading_attr_default() {
public function test_wp_filter_content_tags_with_wp_get_loading_attr_default() {
global $wp_query, $wp_the_query;
$img1 = get_image_tag( self::$large_id, '', '', '', 'large' );

View File

@ -879,7 +879,7 @@ class Tests_Post_wpInsertPost extends WP_UnitTestCase {
/**
* @ticket 19954
*/
function test_updating_a_post_should_not_trash_categories() {
public function test_updating_a_post_should_not_trash_categories() {
// Create a category and attach it to a new post.
$term_id = self::factory()->term->create(
array(

View File

@ -217,7 +217,7 @@ class Tests_Query_FieldsClause extends WP_UnitTestCase {
* @param string $fields The fields to SELECT.
* @return string The filtered fields.
*/
function filter_posts_fields( $fields ) {
public function filter_posts_fields( $fields ) {
return "$fields, 1 as test_post_fields";
}
@ -227,7 +227,7 @@ class Tests_Query_FieldsClause extends WP_UnitTestCase {
* @param array $clauses The WP_Query database clauses.
* @return array The filtered database clauses.
*/
function filter_posts_clauses( $clauses ) {
public function filter_posts_clauses( $clauses ) {
$clauses['fields'] .= ', 2 as test_post_clauses';
return $clauses;
}

View File

@ -201,7 +201,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
$this->assertEqualSetsWithIndex( $expected_no_origin, $actual_no_origin );
}
function test_get_settings_appearance_true_opts_in() {
public function test_get_settings_appearance_true_opts_in() {
$theme_json = new WP_Theme_JSON(
array(
'version' => WP_Theme_JSON::LATEST_SCHEMA,
@ -280,7 +280,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
$this->assertEqualSetsWithIndex( $expected, $actual );
}
function test_get_settings_appearance_false_does_not_opt_in() {
public function test_get_settings_appearance_false_does_not_opt_in() {
$theme_json = new WP_Theme_JSON(
array(
'version' => WP_Theme_JSON::LATEST_SCHEMA,
@ -2735,7 +2735,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
/**
* @ticket 55505
*/
function test_export_data() {
public function test_export_data() {
$theme = new WP_Theme_JSON(
array(
'version' => 2,
@ -2813,7 +2813,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
/**
* @ticket 55505
*/
function test_export_data_deals_with_empty_user_data() {
public function test_export_data_deals_with_empty_user_data() {
$theme = new WP_Theme_JSON(
array(
'version' => 2,
@ -2863,7 +2863,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
/**
* @ticket 55505
*/
function test_export_data_deals_with_empty_theme_data() {
public function test_export_data_deals_with_empty_theme_data() {
$user = new WP_Theme_JSON(
array(
'version' => 2,
@ -2914,7 +2914,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
/**
* @ticket 55505
*/
function test_export_data_deals_with_empty_data() {
public function test_export_data_deals_with_empty_data() {
$theme_v2 = new WP_Theme_JSON(
array(
'version' => 2,
@ -2939,7 +2939,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
/**
* @ticket 55505
*/
function test_export_data_sets_appearance_tools() {
public function test_export_data_sets_appearance_tools() {
$theme = new WP_Theme_JSON(
array(
'version' => 2,
@ -2973,7 +2973,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
/**
* @ticket 56611
*/
function test_export_data_sets_use_root_padding_aware_alignments() {
public function test_export_data_sets_use_root_padding_aware_alignments() {
$theme = new WP_Theme_JSON(
array(
'version' => 2,
@ -3506,7 +3506,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
/**
* @ticket 56467
*/
function test_get_styles_for_block_with_padding_aware_alignments() {
public function test_get_styles_for_block_with_padding_aware_alignments() {
$theme_json = new WP_Theme_JSON(
array(
'version' => 2,
@ -3540,7 +3540,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
/**
* @ticket 56467
*/
function test_get_styles_for_block_without_padding_aware_alignments() {
public function test_get_styles_for_block_without_padding_aware_alignments() {
$theme_json = new WP_Theme_JSON(
array(
'version' => 2,
@ -3571,7 +3571,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
/**
* @ticket 56467
*/
function test_get_styles_for_block_with_content_width() {
public function test_get_styles_for_block_with_content_width() {
$theme_json = new WP_Theme_JSON(
array(
'version' => 2,
@ -3598,7 +3598,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
/**
* @ticket 56611
*/
function test_get_styles_with_appearance_tools() {
public function test_get_styles_with_appearance_tools() {
$theme_json = new WP_Theme_JSON(
array(
'version' => 2,
@ -3628,7 +3628,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
* @param array $spacing_scale Example spacing scale definitions from the data provider.
* @param array $expected_output Expected output from data provider.
*/
function test_should_set_spacing_sizes( $spacing_scale, $expected_output ) {
public function test_should_set_spacing_sizes( $spacing_scale, $expected_output ) {
$theme_json = new WP_Theme_JSON(
array(
'version' => 2,
@ -3651,7 +3651,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
*
* @return array
*/
function data_generate_spacing_scale_fixtures() {
public function data_generate_spacing_scale_fixtures() {
return array(
'only one value when single step in spacing scale' => array(
'spacing_scale' => array(
@ -3945,7 +3945,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
*
* @return array
*/
function data_set_spacing_sizes_when_invalid() {
public function data_set_spacing_sizes_when_invalid() {
return array(
'missing operator value' => array(
'spacing_scale' => array(
@ -4033,7 +4033,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
*
* @return array
*/
function data_update_separator_declarations() {
public function data_update_separator_declarations() {
return array(
// If only background is defined, test that includes border-color to the style so it is applied on the front end.
'only background' => array(

View File

@ -450,7 +450,7 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase {
/**
* @ticket 54336
*/
function test_add_theme_supports_are_loaded_for_themes_without_theme_json() {
public function test_add_theme_supports_are_loaded_for_themes_without_theme_json() {
switch_theme( 'default' );
$color_palette = array(
array(
@ -498,7 +498,7 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase {
* @ticket 54336
* @ticket 56611
*/
function test_merges_child_theme_json_into_parent_theme_json() {
public function test_merges_child_theme_json_into_parent_theme_json() {
switch_theme( 'block-theme-child' );
$actual_settings = WP_Theme_JSON_Resolver::get_theme_data()->get_settings();
@ -619,7 +619,7 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase {
/**
* @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles
*/
function test_get_user_data_from_wp_global_styles_does_not_use_uncached_queries() {
public function test_get_user_data_from_wp_global_styles_does_not_use_uncached_queries() {
// Switch to a theme that does have support.
switch_theme( 'block-theme' );
wp_set_current_user( self::$administrator_id );
@ -659,7 +659,7 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase {
/**
* @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles
*/
function test_get_user_data_from_wp_global_styles_does_not_use_uncached_queries_for_logged_out_users() {
public function test_get_user_data_from_wp_global_styles_does_not_use_uncached_queries_for_logged_out_users() {
// Switch to a theme that does have support.
switch_theme( 'block-theme' );
$theme = wp_get_theme();
@ -680,7 +680,7 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase {
* @ticket 56945
* @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles
*/
function test_get_user_data_from_wp_global_styles_does_not_run_for_theme_without_support() {
public function test_get_user_data_from_wp_global_styles_does_not_run_for_theme_without_support() {
// The 'default' theme does not support theme.json.
switch_theme( 'default' );
wp_set_current_user( self::$administrator_id );
@ -702,7 +702,7 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase {
* @ticket 55392
* @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles
*/
function test_get_user_data_from_wp_global_styles_does_exist() {
public function test_get_user_data_from_wp_global_styles_does_exist() {
// Switch to a theme that does have support.
switch_theme( 'block-theme' );
$theme = wp_get_theme();
@ -719,7 +719,7 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase {
* @ticket 55392
* @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles
*/
function test_get_user_data_from_wp_global_styles_create_post() {
public function test_get_user_data_from_wp_global_styles_create_post() {
// Switch to a theme that does have support.
switch_theme( 'block-theme' );
$theme = wp_get_theme( 'testing' );
@ -738,7 +738,7 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase {
* @ticket 55392
* @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles
*/
function test_get_user_data_from_wp_global_styles_filter_state() {
public function test_get_user_data_from_wp_global_styles_filter_state() {
// Switch to a theme that does have support.
switch_theme( 'block-theme' );
$theme = wp_get_theme( 'foo' );
@ -754,7 +754,7 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase {
* @ticket 56835
* @covers WP_Theme_JSON_Resolver::get_theme_data
*/
function test_get_theme_data_theme_supports_overrides_theme_json() {
public function test_get_theme_data_theme_supports_overrides_theme_json() {
// Test that get_theme_data() returns a WP_Theme_JSON object.
$theme_json_resolver = new WP_Theme_JSON_Resolver();
$theme_data = $theme_json_resolver->get_theme_data();
@ -777,7 +777,7 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase {
* @ticket 56945
* @covers WP_Theme_JSON_Resolver::get_theme_data
*/
function test_get_theme_data_does_not_parse_theme_json_if_not_present() {
public function test_get_theme_data_does_not_parse_theme_json_if_not_present() {
// The 'default' theme does not support theme.json.
switch_theme( 'default' );

View File

@ -19,7 +19,7 @@ class Tests_Theme_wpThemeJsonSchema extends WP_UnitTestCase {
/**
* @ticket 54336
*/
function test_migrate_v1_to_v2() {
public function test_migrate_v1_to_v2() {
$theme_json_v1 = array(
'version' => 1,
'settings' => array(

View File

@ -2011,7 +2011,7 @@ class Tests_User_Query extends WP_UnitTestCase {
*
* @return array
*/
function data_returning_field_subset_as_string() {
public function data_returning_field_subset_as_string() {
$data = array(
'id' => array(
'fields' => 'id',
@ -2093,7 +2093,7 @@ class Tests_User_Query extends WP_UnitTestCase {
*
* @return array
*/
function data_returning_field_subset_as_array() {
public function data_returning_field_subset_as_array() {
$data = array(
'id' => array(
'fields' => array( 'id' ),

View File

@ -593,7 +593,7 @@ class Tests_Widgets extends WP_UnitTestCase {
/**
* @ticket 52728
*/
function test_widget_display_callback_handles_arrayobject() {
public function test_widget_display_callback_handles_arrayobject() {
$widget = new WP_Widget_Text();
register_widget( $widget );