From 8f86cdb2e04f413e3258bee32c9981892732833d Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Tue, 29 Nov 2022 12:32:37 +0000
Subject: [PATCH] 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
---
.../tests/admin/wpCommentsListTable.php | 2 +-
.../tests/admin/wpPostCommentsListTable.php | 2 +-
.../phpunit/tests/admin/wpPostsListTable.php | 20 ++++++------
tests/phpunit/tests/block-supports/border.php | 10 +++---
tests/phpunit/tests/block-supports/colors.php | 10 +++---
tests/phpunit/tests/block-supports/layout.php | 14 ++++----
.../phpunit/tests/block-supports/spacing.php | 10 +++---
.../tests/block-supports/typography.php | 18 +++++------
tests/phpunit/tests/block-template-utils.php | 18 +++++------
tests/phpunit/tests/block-template.php | 12 +++----
.../tests/blocks/renderCommentTemplate.php | 20 ++++++------
tests/phpunit/tests/functions.php | 2 +-
tests/phpunit/tests/kses.php | 20 ++++++------
tests/phpunit/tests/media.php | 8 ++---
tests/phpunit/tests/post/wpInsertPost.php | 2 +-
tests/phpunit/tests/query/fieldsClause.php | 4 +--
tests/phpunit/tests/theme/wpThemeJson.php | 32 +++++++++----------
.../tests/theme/wpThemeJsonResolver.php | 20 ++++++------
.../phpunit/tests/theme/wpThemeJsonSchema.php | 2 +-
tests/phpunit/tests/user/query.php | 4 +--
tests/phpunit/tests/widgets.php | 2 +-
21 files changed, 116 insertions(+), 116 deletions(-)
diff --git a/tests/phpunit/tests/admin/wpCommentsListTable.php b/tests/phpunit/tests/admin/wpCommentsListTable.php
index 20fcd836e2..a394823d37 100644
--- a/tests/phpunit/tests/admin/wpCommentsListTable.php
+++ b/tests/phpunit/tests/admin/wpCommentsListTable.php
@@ -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' ) );
}
diff --git a/tests/phpunit/tests/admin/wpPostCommentsListTable.php b/tests/phpunit/tests/admin/wpPostCommentsListTable.php
index 98cb834bff..126126327f 100644
--- a/tests/phpunit/tests/admin/wpPostCommentsListTable.php
+++ b/tests/phpunit/tests/admin/wpPostCommentsListTable.php
@@ -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' ) );
}
diff --git a/tests/phpunit/tests/admin/wpPostsListTable.php b/tests/phpunit/tests/admin/wpPostsListTable.php
index 9e19ff3d8a..c2dd5f586a 100644
--- a/tests/phpunit/tests/admin/wpPostsListTable.php
+++ b/tests/phpunit/tests/admin/wpPostsListTable.php
@@ -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';
diff --git a/tests/phpunit/tests/block-supports/border.php b/tests/phpunit/tests/block-supports/border.php
index 204c8e43a0..aae4d4d2cc 100644
--- a/tests/phpunit/tests/block-supports/border.php
+++ b/tests/phpunit/tests/block-supports/border.php
@@ -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,
diff --git a/tests/phpunit/tests/block-supports/colors.php b/tests/phpunit/tests/block-supports/colors.php
index 109709e3d7..f9d302a741 100644
--- a/tests/phpunit/tests/block-supports/colors.php
+++ b/tests/phpunit/tests/block-supports/colors.php
@@ -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,
diff --git a/tests/phpunit/tests/block-supports/layout.php b/tests/phpunit/tests/block-supports/layout.php
index 3611c28efa..bcc21775ba 100644
--- a/tests/phpunit/tests/block-supports/layout.php
+++ b/tests/phpunit/tests/block-supports/layout.php
@@ -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',
diff --git a/tests/phpunit/tests/block-supports/spacing.php b/tests/phpunit/tests/block-supports/spacing.php
index e0a849cf6b..4b5ada3798 100644
--- a/tests/phpunit/tests/block-supports/spacing.php
+++ b/tests/phpunit/tests/block-supports/spacing.php
@@ -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,
diff --git a/tests/phpunit/tests/block-supports/typography.php b/tests/phpunit/tests/block-supports/typography.php
index b9d16fbdf4..177a154b9e 100644
--- a/tests/phpunit/tests/block-supports/typography.php
+++ b/tests/phpunit/tests/block-supports/typography.php
@@ -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 );
diff --git a/tests/phpunit/tests/block-template-utils.php b/tests/phpunit/tests/block-template-utils.php
index a77f7e9d81..6e4a5b9e5c 100644
--- a/tests/phpunit/tests/block-template-utils.php
+++ b/tests/phpunit/tests/block-template-utils.php
@@ -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 = '';
$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(
'',
@@ -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 = '';
$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' );
diff --git a/tests/phpunit/tests/block-template.php b/tests/phpunit/tests/block-template.php
index b53aa496b0..5439ac3793 100644
--- a/tests/phpunit/tests/block-template.php
+++ b/tests/phpunit/tests/block-template.php
@@ -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' );
diff --git a/tests/phpunit/tests/blocks/renderCommentTemplate.php b/tests/phpunit/tests/blocks/renderCommentTemplate.php
index 848b2caf38..5bfcd76487 100644
--- a/tests/phpunit/tests/blocks/renderCommentTemplate.php
+++ b/tests/phpunit/tests/blocks/renderCommentTemplate.php
@@ -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(
''
);
@@ -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(
''
@@ -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(
''
);
@@ -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(
''
);
@@ -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(
''
);
@@ -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(
''
);
diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php
index 7f855e110f..1fdba6ca84 100644
--- a/tests/phpunit/tests/functions.php
+++ b/tests/phpunit/tests/functions.php
@@ -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,
diff --git a/tests/phpunit/tests/kses.php b/tests/phpunit/tests/kses.php
index 294cb84779..84787a4501 100644
--- a/tests/phpunit/tests/kses.php
+++ b/tests/phpunit/tests/kses.php
@@ -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(
'',
@@ -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(
'',
@@ -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 = <<