-
From 583ed282ab73ad0e1ba098fb641f01c0ec5f684e Mon Sep 17 00:00:00 2001
From: jrfnl <jrfnl@users.noreply.github.com>
Date: Sun, 24 Jul 2022 00:07:10 +0200
Subject: [PATCH] CS: always declare visibility for methods
---
.../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/dependencies.php | 2 +-
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 +-
22 files changed, 117 insertions(+), 117 deletions(-)
diff --git a/tests/phpunit/tests/admin/wpCommentsListTable.php b/tests/phpunit/tests/admin/wpCommentsListTable.php
index 20fcd836e2..a394823d37 100644
a
|
b
|
class Tests_Admin_wpCommentsListTable extends WP_UnitTestCase { |
10 | 10 | */ |
11 | 11 | protected $table; |
12 | 12 | |
13 | | function set_up() { |
| 13 | public function set_up() { |
14 | 14 | parent::set_up(); |
15 | 15 | $this->table = _get_list_table( 'WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); |
16 | 16 | } |
-
diff --git a/tests/phpunit/tests/admin/wpPostCommentsListTable.php b/tests/phpunit/tests/admin/wpPostCommentsListTable.php
index 98cb834bff..126126327f 100644
a
|
b
|
class Tests_Admin_wpPostCommentsListTable extends WP_UnitTestCase { |
12 | 12 | */ |
13 | 13 | protected $table; |
14 | 14 | |
15 | | function set_up() { |
| 15 | public function set_up() { |
16 | 16 | parent::set_up(); |
17 | 17 | $this->table = _get_list_table( 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-post-comments' ) ); |
18 | 18 | } |
-
diff --git a/tests/phpunit/tests/admin/wpPostsListTable.php b/tests/phpunit/tests/admin/wpPostsListTable.php
index 9e19ff3d8a..c2dd5f586a 100644
a
|
b
|
class Tests_Admin_wpPostsListTable extends WP_UnitTestCase { |
14 | 14 | */ |
15 | 15 | protected $table; |
16 | 16 | |
17 | | function set_up() { |
| 17 | public function set_up() { |
18 | 18 | parent::set_up(); |
19 | 19 | $this->table = _get_list_table( 'WP_Posts_List_Table', array( 'screen' => 'edit-page' ) ); |
20 | 20 | } |
… |
… |
class Tests_Admin_wpPostsListTable extends WP_UnitTestCase { |
79 | 79 | * @covers WP_Posts_List_Table::display_rows |
80 | 80 | * @covers WP_Posts_List_Table::set_hierarchical_display |
81 | 81 | */ |
82 | | function test_list_hierarchical_pages_first_page() { |
| 82 | public function test_list_hierarchical_pages_first_page() { |
83 | 83 | $this->_test_list_hierarchical_page( |
84 | 84 | array( |
85 | 85 | 'paged' => 1, |
… |
… |
class Tests_Admin_wpPostsListTable extends WP_UnitTestCase { |
98 | 98 | * @covers WP_Posts_List_Table::display_rows |
99 | 99 | * @covers WP_Posts_List_Table::set_hierarchical_display |
100 | 100 | */ |
101 | | function test_list_hierarchical_pages_second_page() { |
| 101 | public function test_list_hierarchical_pages_second_page() { |
102 | 102 | $this->_test_list_hierarchical_page( |
103 | 103 | array( |
104 | 104 | 'paged' => 2, |
… |
… |
class Tests_Admin_wpPostsListTable extends WP_UnitTestCase { |
118 | 118 | * @covers WP_Posts_List_Table::display_rows |
119 | 119 | * @covers WP_Posts_List_Table::set_hierarchical_display |
120 | 120 | */ |
121 | | function test_search_hierarchical_pages_first_page() { |
| 121 | public function test_search_hierarchical_pages_first_page() { |
122 | 122 | $this->_test_list_hierarchical_page( |
123 | 123 | array( |
124 | 124 | 'paged' => 1, |
… |
… |
class Tests_Admin_wpPostsListTable extends WP_UnitTestCase { |
138 | 138 | * @covers WP_Posts_List_Table::display_rows |
139 | 139 | * @covers WP_Posts_List_Table::set_hierarchical_display |
140 | 140 | */ |
141 | | function test_search_hierarchical_pages_second_page() { |
| 141 | public function test_search_hierarchical_pages_second_page() { |
142 | 142 | $this->_test_list_hierarchical_page( |
143 | 143 | array( |
144 | 144 | 'paged' => 2, |
… |
… |
class Tests_Admin_wpPostsListTable extends WP_UnitTestCase { |
158 | 158 | * @covers WP_Posts_List_Table::display_rows |
159 | 159 | * @covers WP_Posts_List_Table::set_hierarchical_display |
160 | 160 | */ |
161 | | function test_grandchildren_hierarchical_pages_first_page() { |
| 161 | public function test_grandchildren_hierarchical_pages_first_page() { |
162 | 162 | // Page 6 is the first page with grandchildren. |
163 | 163 | $this->_test_list_hierarchical_page( |
164 | 164 | array( |
… |
… |
class Tests_Admin_wpPostsListTable extends WP_UnitTestCase { |
180 | 180 | * @covers WP_Posts_List_Table::display_rows |
181 | 181 | * @covers WP_Posts_List_Table::set_hierarchical_display |
182 | 182 | */ |
183 | | function test_grandchildren_hierarchical_pages_second_page() { |
| 183 | public function test_grandchildren_hierarchical_pages_second_page() { |
184 | 184 | // Page 7 is the second page with grandchildren. |
185 | 185 | $this->_test_list_hierarchical_page( |
186 | 186 | array( |
… |
… |
class Tests_Admin_wpPostsListTable extends WP_UnitTestCase { |
260 | 260 | * |
261 | 261 | * @covers WP_Posts_List_Table::extra_tablenav |
262 | 262 | */ |
263 | | function test_filter_button_should_not_be_shown_if_there_are_no_posts() { |
| 263 | public function test_filter_button_should_not_be_shown_if_there_are_no_posts() { |
264 | 264 | // Set post type to a non-existent one. |
265 | 265 | $this->table->screen->post_type = 'foo'; |
266 | 266 | |
… |
… |
class Tests_Admin_wpPostsListTable extends WP_UnitTestCase { |
276 | 276 | * |
277 | 277 | * @covers WP_Posts_List_Table::extra_tablenav |
278 | 278 | */ |
279 | | function test_months_dropdown_should_not_be_shown_if_there_are_no_posts() { |
| 279 | public function test_months_dropdown_should_not_be_shown_if_there_are_no_posts() { |
280 | 280 | // Set post type to a non-existent one. |
281 | 281 | $this->table->screen->post_type = 'foo'; |
282 | 282 | |
… |
… |
class Tests_Admin_wpPostsListTable extends WP_UnitTestCase { |
292 | 292 | * |
293 | 293 | * @covers WP_Posts_List_Table::extra_tablenav |
294 | 294 | */ |
295 | | function test_category_dropdown_should_not_be_shown_if_there_are_no_posts() { |
| 295 | public function test_category_dropdown_should_not_be_shown_if_there_are_no_posts() { |
296 | 296 | // Set post type to a non-existent one. |
297 | 297 | $this->table->screen->post_type = 'foo'; |
298 | 298 | |
-
diff --git a/tests/phpunit/tests/block-supports/border.php b/tests/phpunit/tests/block-supports/border.php
index 204c8e43a0..aae4d4d2cc 100644
a
|
b
|
class Test_Block_Supports_Border extends WP_UnitTestCase { |
10 | 10 | */ |
11 | 11 | private $test_block_name; |
12 | 12 | |
13 | | function set_up() { |
| 13 | public function set_up() { |
14 | 14 | parent::set_up(); |
15 | 15 | $this->test_block_name = null; |
16 | 16 | } |
17 | 17 | |
18 | | function tear_down() { |
| 18 | public function tear_down() { |
19 | 19 | unregister_block_type( $this->test_block_name ); |
20 | 20 | $this->test_block_name = null; |
21 | 21 | parent::set_up(); |
… |
… |
class Test_Block_Supports_Border extends WP_UnitTestCase { |
24 | 24 | /** |
25 | 25 | * @ticket 55505 |
26 | 26 | */ |
27 | | function test_border_color_slug_with_numbers_is_kebab_cased_properly() { |
| 27 | public function test_border_color_slug_with_numbers_is_kebab_cased_properly() { |
28 | 28 | $this->test_block_name = 'test/border-color-slug-with-numbers-is-kebab-cased-properly'; |
29 | 29 | register_block_type( |
30 | 30 | $this->test_block_name, |
… |
… |
class Test_Block_Supports_Border extends WP_UnitTestCase { |
73 | 73 | /** |
74 | 74 | * @ticket 55505 |
75 | 75 | */ |
76 | | function test_border_with_skipped_serialization_block_supports() { |
| 76 | public function test_border_with_skipped_serialization_block_supports() { |
77 | 77 | $this->test_block_name = 'test/border-with-skipped-serialization-block-supports'; |
78 | 78 | register_block_type( |
79 | 79 | $this->test_block_name, |
… |
… |
class Test_Block_Supports_Border extends WP_UnitTestCase { |
117 | 117 | /** |
118 | 118 | * @ticket 55505 |
119 | 119 | */ |
120 | | function test_radius_with_individual_skipped_serialization_block_supports() { |
| 120 | public function test_radius_with_individual_skipped_serialization_block_supports() { |
121 | 121 | $this->test_block_name = 'test/radius-with-individual-skipped-serialization-block-supports'; |
122 | 122 | register_block_type( |
123 | 123 | $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
|
b
|
class Tests_Block_Supports_Colors extends WP_UnitTestCase { |
10 | 10 | */ |
11 | 11 | private $test_block_name; |
12 | 12 | |
13 | | function set_up() { |
| 13 | public function set_up() { |
14 | 14 | parent::set_up(); |
15 | 15 | $this->test_block_name = null; |
16 | 16 | } |
17 | 17 | |
18 | | function tear_down() { |
| 18 | public function tear_down() { |
19 | 19 | unregister_block_type( $this->test_block_name ); |
20 | 20 | $this->test_block_name = null; |
21 | 21 | parent::set_up(); |
… |
… |
class Tests_Block_Supports_Colors extends WP_UnitTestCase { |
24 | 24 | /** |
25 | 25 | * @ticket 54337 |
26 | 26 | */ |
27 | | function test_color_slugs_with_numbers_are_kebab_cased_properly() { |
| 27 | public function test_color_slugs_with_numbers_are_kebab_cased_properly() { |
28 | 28 | $this->test_block_name = 'test/color-slug-with-numbers'; |
29 | 29 | register_block_type( |
30 | 30 | $this->test_block_name, |
… |
… |
class Tests_Block_Supports_Colors extends WP_UnitTestCase { |
68 | 68 | /** |
69 | 69 | * @ticket 55505 |
70 | 70 | */ |
71 | | function test_color_with_skipped_serialization_block_supports() { |
| 71 | public function test_color_with_skipped_serialization_block_supports() { |
72 | 72 | $this->test_block_name = 'test/color-with-skipped-serialization-block-supports'; |
73 | 73 | register_block_type( |
74 | 74 | $this->test_block_name, |
… |
… |
class Tests_Block_Supports_Colors extends WP_UnitTestCase { |
109 | 109 | /** |
110 | 110 | * @ticket 55505 |
111 | 111 | */ |
112 | | function test_gradient_with_individual_skipped_serialization_block_supports() { |
| 112 | public function test_gradient_with_individual_skipped_serialization_block_supports() { |
113 | 113 | $this->test_block_name = 'test/gradient-with-individual-skipped-serialization-block-support'; |
114 | 114 | register_block_type( |
115 | 115 | $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
|
b
|
class Test_Block_Supports_Layout extends WP_UnitTestCase { |
32 | 32 | */ |
33 | 33 | private $orig_theme_dir; |
34 | 34 | |
35 | | function set_up() { |
| 35 | public function set_up() { |
36 | 36 | parent::set_up(); |
37 | 37 | $this->theme_root = realpath( DIR_TESTDATA . '/themedir1' ); |
38 | 38 | $this->orig_theme_dir = $GLOBALS['wp_theme_directories']; |
… |
… |
class Test_Block_Supports_Layout extends WP_UnitTestCase { |
50 | 50 | unset( $GLOBALS['wp_themes'] ); |
51 | 51 | } |
52 | 52 | |
53 | | function tear_down() { |
| 53 | public function tear_down() { |
54 | 54 | $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir; |
55 | 55 | |
56 | 56 | // Clear up the filters to modify the theme root. |
… |
… |
class Test_Block_Supports_Layout extends WP_UnitTestCase { |
63 | 63 | parent::tear_down(); |
64 | 64 | } |
65 | 65 | |
66 | | function filter_set_theme_root() { |
| 66 | public function filter_set_theme_root() { |
67 | 67 | return $this->theme_root; |
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
71 | 71 | * @ticket 55505 |
72 | 72 | */ |
73 | | function test_outer_container_not_restored_for_non_aligned_image_block_with_non_themejson_theme() { |
| 73 | public function test_outer_container_not_restored_for_non_aligned_image_block_with_non_themejson_theme() { |
74 | 74 | // The "default" theme doesn't have theme.json support. |
75 | 75 | switch_theme( 'default' ); |
76 | 76 | $block = array( |
… |
… |
class Test_Block_Supports_Layout extends WP_UnitTestCase { |
86 | 86 | /** |
87 | 87 | * @ticket 55505 |
88 | 88 | */ |
89 | | function test_outer_container_restored_for_aligned_image_block_with_non_themejson_theme() { |
| 89 | public function test_outer_container_restored_for_aligned_image_block_with_non_themejson_theme() { |
90 | 90 | // The "default" theme doesn't have theme.json support. |
91 | 91 | switch_theme( 'default' ); |
92 | 92 | $block = array( |
… |
… |
class Test_Block_Supports_Layout extends WP_UnitTestCase { |
107 | 107 | * @param string $block_image_html The block image HTML passed to `wp_restore_image_outer_container`. |
108 | 108 | * @param string $expected The expected block image HTML. |
109 | 109 | */ |
110 | | function test_additional_styles_moved_to_restored_outer_container_for_aligned_image_block_with_non_themejson_theme( $block_image_html, $expected ) { |
| 110 | public function test_additional_styles_moved_to_restored_outer_container_for_aligned_image_block_with_non_themejson_theme( $block_image_html, $expected ) { |
111 | 111 | // The "default" theme doesn't have theme.json support. |
112 | 112 | switch_theme( 'default' ); |
113 | 113 | $block = array( |
… |
… |
class Test_Block_Supports_Layout extends WP_UnitTestCase { |
160 | 160 | /** |
161 | 161 | * @ticket 55505 |
162 | 162 | */ |
163 | | function test_outer_container_not_restored_for_aligned_image_block_with_themejson_theme() { |
| 163 | public function test_outer_container_not_restored_for_aligned_image_block_with_themejson_theme() { |
164 | 164 | switch_theme( 'block-theme' ); |
165 | 165 | $block = array( |
166 | 166 | '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
|
b
|
class Test_Block_Supports_Spacing extends WP_UnitTestCase { |
10 | 10 | */ |
11 | 11 | private $test_block_name; |
12 | 12 | |
13 | | function set_up() { |
| 13 | public function set_up() { |
14 | 14 | parent::set_up(); |
15 | 15 | $this->test_block_name = null; |
16 | 16 | } |
17 | 17 | |
18 | | function tear_down() { |
| 18 | public function tear_down() { |
19 | 19 | unregister_block_type( $this->test_block_name ); |
20 | 20 | $this->test_block_name = null; |
21 | 21 | parent::set_up(); |
… |
… |
class Test_Block_Supports_Spacing extends WP_UnitTestCase { |
24 | 24 | /** |
25 | 25 | * @ticket 55505 |
26 | 26 | */ |
27 | | function test_spacing_style_is_applied() { |
| 27 | public function test_spacing_style_is_applied() { |
28 | 28 | $this->test_block_name = 'test/spacing-style-is-applied'; |
29 | 29 | register_block_type( |
30 | 30 | $this->test_block_name, |
… |
… |
class Test_Block_Supports_Spacing extends WP_UnitTestCase { |
72 | 72 | /** |
73 | 73 | * @ticket 55505 |
74 | 74 | */ |
75 | | function test_spacing_with_skipped_serialization_block_supports() { |
| 75 | public function test_spacing_with_skipped_serialization_block_supports() { |
76 | 76 | $this->test_block_name = 'test/spacing-with-skipped-serialization-block-supports'; |
77 | 77 | register_block_type( |
78 | 78 | $this->test_block_name, |
… |
… |
class Test_Block_Supports_Spacing extends WP_UnitTestCase { |
119 | 119 | /** |
120 | 120 | * @ticket 55505 |
121 | 121 | */ |
122 | | function test_margin_with_individual_skipped_serialization_block_supports() { |
| 122 | public function test_margin_with_individual_skipped_serialization_block_supports() { |
123 | 123 | $this->test_block_name = 'test/margin-with-individual-skipped-serialization-block-supports'; |
124 | 124 | register_block_type( |
125 | 125 | $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
|
b
|
class Tests_Block_Supports_Typography extends WP_UnitTestCase { |
23 | 23 | */ |
24 | 24 | private $orig_theme_dir; |
25 | 25 | |
26 | | function set_up() { |
| 26 | public function set_up() { |
27 | 27 | parent::set_up(); |
28 | 28 | |
29 | 29 | $this->test_block_name = null; |
… |
… |
class Tests_Block_Supports_Typography extends WP_UnitTestCase { |
48 | 48 | /** |
49 | 49 | * Unregisters block type after each test. |
50 | 50 | */ |
51 | | function tear_down() { |
| 51 | public function tear_down() { |
52 | 52 | // Restores the original theme directory setup. |
53 | 53 | $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir; |
54 | 54 | wp_clean_themes_cache(); |
… |
… |
class Tests_Block_Supports_Typography extends WP_UnitTestCase { |
68 | 68 | * |
69 | 69 | * @covers ::wp_apply_typography_support |
70 | 70 | */ |
71 | | function test_should_kebab_case_font_size_slug_with_numbers() { |
| 71 | public function test_should_kebab_case_font_size_slug_with_numbers() { |
72 | 72 | $this->test_block_name = 'test/font-size-slug-with-numbers'; |
73 | 73 | register_block_type( |
74 | 74 | $this->test_block_name, |
… |
… |
class Tests_Block_Supports_Typography extends WP_UnitTestCase { |
104 | 104 | * |
105 | 105 | * @covers ::wp_apply_typography_support |
106 | 106 | */ |
107 | | function test_should_generate_font_family_with_legacy_inline_styles_using_a_value() { |
| 107 | public function test_should_generate_font_family_with_legacy_inline_styles_using_a_value() { |
108 | 108 | $this->test_block_name = 'test/font-family-with-inline-styles-using-value'; |
109 | 109 | register_block_type( |
110 | 110 | $this->test_block_name, |
… |
… |
class Tests_Block_Supports_Typography extends WP_UnitTestCase { |
139 | 139 | * |
140 | 140 | * @covers ::wp_apply_typography_support |
141 | 141 | */ |
142 | | function test_should_skip_serialization_for_typography_block_supports() { |
| 142 | public function test_should_skip_serialization_for_typography_block_supports() { |
143 | 143 | $this->test_block_name = 'test/typography-with-skipped-serialization-block-supports'; |
144 | 144 | register_block_type( |
145 | 145 | $this->test_block_name, |
… |
… |
class Tests_Block_Supports_Typography extends WP_UnitTestCase { |
187 | 187 | * |
188 | 188 | * @covers ::wp_apply_typography_support |
189 | 189 | */ |
190 | | function test_should_skip_serialization_for_letter_spacing_block_supports() { |
| 190 | public function test_should_skip_serialization_for_letter_spacing_block_supports() { |
191 | 191 | $this->test_block_name = 'test/letter-spacing-with-individual-skipped-serialization-block-supports'; |
192 | 192 | register_block_type( |
193 | 193 | $this->test_block_name, |
… |
… |
class Tests_Block_Supports_Typography extends WP_UnitTestCase { |
225 | 225 | * |
226 | 226 | * @covers ::wp_apply_typography_support |
227 | 227 | */ |
228 | | function test_should_generate_css_var_for_font_family_with_legacy_inline_styles() { |
| 228 | public function test_should_generate_css_var_for_font_family_with_legacy_inline_styles() { |
229 | 229 | $this->test_block_name = 'test/font-family-with-inline-styles-using-css-var'; |
230 | 230 | register_block_type( |
231 | 231 | $this->test_block_name, |
… |
… |
class Tests_Block_Supports_Typography extends WP_UnitTestCase { |
260 | 260 | * |
261 | 261 | * @covers ::wp_apply_typography_support |
262 | 262 | */ |
263 | | function test_should_generate_classname_for_font_family() { |
| 263 | public function test_should_generate_classname_for_font_family() { |
264 | 264 | $this->test_block_name = 'test/font-family-with-class'; |
265 | 265 | register_block_type( |
266 | 266 | $this->test_block_name, |
… |
… |
class Tests_Block_Supports_Typography extends WP_UnitTestCase { |
308 | 308 | * @param bool $should_use_fluid_typography An override to switch fluid typography "on". Can be used for unit testing. |
309 | 309 | * @param string $expected_output Expected output. |
310 | 310 | */ |
311 | | function test_wp_get_typography_font_size_value( $font_size_preset, $should_use_fluid_typography, $expected_output ) { |
| 311 | public function test_wp_get_typography_font_size_value( $font_size_preset, $should_use_fluid_typography, $expected_output ) { |
312 | 312 | $actual = wp_get_typography_font_size_value( $font_size_preset, $should_use_fluid_typography ); |
313 | 313 | |
314 | 314 | $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
|
b
|
class Tests_Block_Template_Utils extends WP_UnitTestCase { |
131 | 131 | * |
132 | 132 | * @covers ::_build_block_template_result_from_post |
133 | 133 | */ |
134 | | function test_build_block_template_result_from_post_with_child_theme() { |
| 134 | public function test_build_block_template_result_from_post_with_child_theme() { |
135 | 135 | switch_theme( 'block-theme-child' ); |
136 | 136 | |
137 | 137 | $template = _build_block_template_result_from_post( |
… |
… |
class Tests_Block_Template_Utils extends WP_UnitTestCase { |
142 | 142 | $this->assertSame( self::TEST_THEME, $template->theme ); |
143 | 143 | } |
144 | 144 | |
145 | | function test_build_block_template_result_from_file() { |
| 145 | public function test_build_block_template_result_from_file() { |
146 | 146 | $template = _build_block_template_result_from_file( |
147 | 147 | array( |
148 | 148 | 'slug' => 'single', |
… |
… |
class Tests_Block_Template_Utils extends WP_UnitTestCase { |
188 | 188 | * |
189 | 189 | * @covers ::_build_block_template_result_from_file |
190 | 190 | */ |
191 | | function test_build_block_template_result_from_file_with_child_theme() { |
| 191 | public function test_build_block_template_result_from_file_with_child_theme() { |
192 | 192 | switch_theme( 'block-theme-child' ); |
193 | 193 | |
194 | 194 | $template = _build_block_template_result_from_file( |
… |
… |
class Tests_Block_Template_Utils extends WP_UnitTestCase { |
203 | 203 | $this->assertSame( self::TEST_THEME, $template->theme ); |
204 | 204 | } |
205 | 205 | |
206 | | function test_inject_theme_attribute_in_block_template_content() { |
| 206 | public function test_inject_theme_attribute_in_block_template_content() { |
207 | 207 | $theme = get_stylesheet(); |
208 | 208 | $content_without_theme_attribute = '<!-- wp:template-part {"slug":"header","align":"full", "tagName":"header","className":"site-header"} /-->'; |
209 | 209 | $template_content = _inject_theme_attribute_in_block_template_content( |
… |
… |
class Tests_Block_Template_Utils extends WP_UnitTestCase { |
249 | 249 | * |
250 | 250 | * @dataProvider data_remove_theme_attribute_in_block_template_content |
251 | 251 | */ |
252 | | function test_remove_theme_attribute_in_block_template_content( $template_content, $expected ) { |
| 252 | public function test_remove_theme_attribute_in_block_template_content( $template_content, $expected ) { |
253 | 253 | $this->assertSame( $expected, _remove_theme_attribute_in_block_template_content( $template_content ) ); |
254 | 254 | } |
255 | 255 | |
256 | | function data_remove_theme_attribute_in_block_template_content() { |
| 256 | public function data_remove_theme_attribute_in_block_template_content() { |
257 | 257 | return array( |
258 | 258 | array( |
259 | 259 | '<!-- wp:template-part {"slug":"header","theme":"tt1-blocks","align":"full","tagName":"header","className":"site-header"} /-->', |
… |
… |
class Tests_Block_Template_Utils extends WP_UnitTestCase { |
279 | 279 | /** |
280 | 280 | * Should retrieve the template from the theme files. |
281 | 281 | */ |
282 | | function test_get_block_template_from_file() { |
| 282 | public function test_get_block_template_from_file() { |
283 | 283 | $id = get_stylesheet() . '//' . 'index'; |
284 | 284 | $template = get_block_template( $id, 'wp_template' ); |
285 | 285 | $this->assertSame( $id, $template->id ); |
… |
… |
class Tests_Block_Template_Utils extends WP_UnitTestCase { |
329 | 329 | /** |
330 | 330 | * Should flatten nested blocks |
331 | 331 | */ |
332 | | function test_flatten_blocks() { |
| 332 | public function test_flatten_blocks() { |
333 | 333 | $content_template_part_inside_group = '<!-- wp:group --><!-- wp:template-part {"slug":"header"} /--><!-- /wp:group -->'; |
334 | 334 | $blocks = parse_blocks( $content_template_part_inside_group ); |
335 | 335 | $actual = _flatten_blocks( $blocks ); |
… |
… |
class Tests_Block_Template_Utils extends WP_UnitTestCase { |
355 | 355 | * @ticket 54448 |
356 | 356 | * @requires extension zip |
357 | 357 | */ |
358 | | function test_wp_generate_block_templates_export_file() { |
| 358 | public function test_wp_generate_block_templates_export_file() { |
359 | 359 | $filename = wp_generate_block_templates_export_file(); |
360 | 360 | $this->assertFileExists( $filename, 'zip file is created at the specified path' ); |
361 | 361 | $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
|
b
|
class Tests_Block_Template extends WP_UnitTestCase { |
28 | 28 | parent::tear_down(); |
29 | 29 | } |
30 | 30 | |
31 | | function test_page_home_block_template_takes_precedence_over_less_specific_block_templates() { |
| 31 | public function test_page_home_block_template_takes_precedence_over_less_specific_block_templates() { |
32 | 32 | global $_wp_current_template_content; |
33 | 33 | $type = 'page'; |
34 | 34 | $templates = array( |
… |
… |
class Tests_Block_Template extends WP_UnitTestCase { |
41 | 41 | $this->assertStringEqualsFile( get_stylesheet_directory() . '/templates/page-home.html', $_wp_current_template_content ); |
42 | 42 | } |
43 | 43 | |
44 | | function test_page_block_template_takes_precedence() { |
| 44 | public function test_page_block_template_takes_precedence() { |
45 | 45 | global $_wp_current_template_content; |
46 | 46 | $type = 'page'; |
47 | 47 | $templates = array( |
… |
… |
class Tests_Block_Template extends WP_UnitTestCase { |
54 | 54 | $this->assertStringEqualsFile( get_stylesheet_directory() . '/templates/page.html', $_wp_current_template_content ); |
55 | 55 | } |
56 | 56 | |
57 | | function test_block_template_takes_precedence_over_equally_specific_php_template() { |
| 57 | public function test_block_template_takes_precedence_over_equally_specific_php_template() { |
58 | 58 | global $_wp_current_template_content; |
59 | 59 | $type = 'index'; |
60 | 60 | $templates = array( |
… |
… |
class Tests_Block_Template extends WP_UnitTestCase { |
71 | 71 | * |
72 | 72 | * Covers https://github.com/WordPress/gutenberg/pull/29026. |
73 | 73 | */ |
74 | | function test_more_specific_php_template_takes_precedence_over_less_specific_block_template() { |
| 74 | public function test_more_specific_php_template_takes_precedence_over_less_specific_block_template() { |
75 | 75 | $page_id_template = 'page-1.php'; |
76 | 76 | $page_id_template_path = get_stylesheet_directory() . '/' . $page_id_template; |
77 | 77 | $type = 'page'; |
… |
… |
class Tests_Block_Template extends WP_UnitTestCase { |
93 | 93 | * Covers https://core.trac.wordpress.org/ticket/54515. |
94 | 94 | * |
95 | 95 | */ |
96 | | function test_child_theme_php_template_takes_precedence_over_equally_specific_parent_theme_block_template() { |
| 96 | public function test_child_theme_php_template_takes_precedence_over_equally_specific_parent_theme_block_template() { |
97 | 97 | switch_theme( 'block-theme-child' ); |
98 | 98 | |
99 | 99 | $page_slug_template = 'page-home.php'; |
… |
… |
class Tests_Block_Template extends WP_UnitTestCase { |
108 | 108 | $this->assertSame( $page_slug_template_path, $resolved_template_path ); |
109 | 109 | } |
110 | 110 | |
111 | | function test_child_theme_block_template_takes_precedence_over_equally_specific_parent_theme_php_template() { |
| 111 | public function test_child_theme_block_template_takes_precedence_over_equally_specific_parent_theme_php_template() { |
112 | 112 | global $_wp_current_template_content; |
113 | 113 | |
114 | 114 | 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
|
b
|
class Tests_Blocks_RenderReusableCommentTemplate extends WP_UnitTestCase { |
87 | 87 | * @ticket 55505 |
88 | 88 | * @covers ::build_comment_query_vars_from_block |
89 | 89 | */ |
90 | | function test_build_comment_query_vars_from_block_with_context() { |
| 90 | public function test_build_comment_query_vars_from_block_with_context() { |
91 | 91 | $parsed_blocks = parse_blocks( |
92 | 92 | '<!-- wp:comment-template --><!-- wp:comment-author-name /--><!-- wp:comment-content /--><!-- /wp:comment-template -->' |
93 | 93 | ); |
… |
… |
class Tests_Blocks_RenderReusableCommentTemplate extends WP_UnitTestCase { |
118 | 118 | * @ticket 55567 |
119 | 119 | * @covers ::build_comment_query_vars_from_block |
120 | 120 | */ |
121 | | function test_build_comment_query_vars_from_block_with_context_no_pagination() { |
| 121 | public function test_build_comment_query_vars_from_block_with_context_no_pagination() { |
122 | 122 | update_option( 'page_comments', false ); |
123 | 123 | $parsed_blocks = parse_blocks( |
124 | 124 | '<!-- wp:comment-template --><!-- wp:comment-author-name /--><!-- wp:comment-content /--><!-- /wp:comment-template -->' |
… |
… |
class Tests_Blocks_RenderReusableCommentTemplate extends WP_UnitTestCase { |
148 | 148 | * @ticket 55505 |
149 | 149 | * @covers ::build_comment_query_vars_from_block |
150 | 150 | */ |
151 | | function test_build_comment_query_vars_from_block_no_context() { |
| 151 | public function test_build_comment_query_vars_from_block_no_context() { |
152 | 152 | $parsed_blocks = parse_blocks( |
153 | 153 | '<!-- wp:comment-template --><!-- wp:comment-author-name /--><!-- wp:comment-content /--><!-- /wp:comment-template -->' |
154 | 154 | ); |
… |
… |
class Tests_Blocks_RenderReusableCommentTemplate extends WP_UnitTestCase { |
178 | 178 | * @ticket 55658 |
179 | 179 | * @covers ::build_comment_query_vars_from_block |
180 | 180 | */ |
181 | | function test_build_comment_query_vars_from_block_pagination_with_no_comments() { |
| 181 | public function test_build_comment_query_vars_from_block_pagination_with_no_comments() { |
182 | 182 | $comments_per_page = get_option( 'comments_per_page' ); |
183 | 183 | $default_comments_page = get_option( 'default_comments_page' ); |
184 | 184 | |
… |
… |
class Tests_Blocks_RenderReusableCommentTemplate extends WP_UnitTestCase { |
230 | 230 | * @ticket 55505 |
231 | 231 | * @covers ::build_comment_query_vars_from_block |
232 | 232 | */ |
233 | | function test_build_comment_query_vars_from_block_sets_cpage_var() { |
| 233 | public function test_build_comment_query_vars_from_block_sets_cpage_var() { |
234 | 234 | |
235 | 235 | // This could be any number, we set a fixed one instead of a random for better performance. |
236 | 236 | $comment_query_max_num_pages = 5; |
… |
… |
class Tests_Blocks_RenderReusableCommentTemplate extends WP_UnitTestCase { |
267 | 267 | * |
268 | 268 | * @ticket 55567 |
269 | 269 | */ |
270 | | function test_rendering_comment_template() { |
| 270 | public function test_rendering_comment_template() { |
271 | 271 | $parsed_blocks = parse_blocks( |
272 | 272 | '<!-- wp:comment-template --><!-- wp:comment-author-name /--><!-- wp:comment-content /--><!-- /wp:comment-template -->' |
273 | 273 | ); |
… |
… |
class Tests_Blocks_RenderReusableCommentTemplate extends WP_UnitTestCase { |
295 | 295 | * |
296 | 296 | * @ticket 55567 |
297 | 297 | */ |
298 | | function test_rendering_comment_template_nested() { |
| 298 | public function test_rendering_comment_template_nested() { |
299 | 299 | $first_level_ids = self::factory()->comment->create_post_comments( |
300 | 300 | self::$custom_post->ID, |
301 | 301 | 2, |
… |
… |
END |
396 | 396 | * |
397 | 397 | * @ticket 55643 |
398 | 398 | */ |
399 | | function test_render_block_core_comment_content_converts_to_html() { |
| 399 | public function test_render_block_core_comment_content_converts_to_html() { |
400 | 400 | $comment_id = self::$comment_ids[0]; |
401 | 401 | $new_content = "Paragraph One\n\nP2L1\nP2L2\n\nhttps://example.com/"; |
402 | 402 | self::factory()->comment->update_object( |
… |
… |
END |
430 | 430 | * @ticket 55634 |
431 | 431 | * @covers ::build_comment_query_vars_from_block |
432 | 432 | */ |
433 | | function test_build_comment_query_vars_from_block_with_comment_preview() { |
| 433 | public function test_build_comment_query_vars_from_block_with_comment_preview() { |
434 | 434 | $parsed_blocks = parse_blocks( |
435 | 435 | '<!-- wp:comment-template --><!-- wp:comment-author-name /--><!-- wp:comment-content /--><!-- /wp:comment-template -->' |
436 | 436 | ); |
… |
… |
END |
471 | 471 | * |
472 | 472 | * @ticket 55643 |
473 | 473 | */ |
474 | | function test_rendering_comment_template_unmoderated_preview() { |
| 474 | public function test_rendering_comment_template_unmoderated_preview() { |
475 | 475 | $parsed_blocks = parse_blocks( |
476 | 476 | '<!-- wp:comment-template --><!-- wp:comment-author-name /--><!-- wp:comment-content /--><!-- /wp:comment-template -->' |
477 | 477 | ); |
-
diff --git a/tests/phpunit/tests/dependencies.php b/tests/phpunit/tests/dependencies.php
index 91971beb88..39a2860fc3 100644
a
|
b
|
class Tests_Dependencies extends WP_UnitTestCase { |
135 | 135 | $this->assertFalse( $dep->query( 'one' ) ); |
136 | 136 | } |
137 | 137 | |
138 | | function test_enqueue_before_register() { |
| 138 | public function test_enqueue_before_register() { |
139 | 139 | $dep = new WP_Dependencies(); |
140 | 140 | |
141 | 141 | $this->assertArrayNotHasKey( 'one', $dep->registered ); |
-
diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php
index 42d70fd774..71cd6b67d1 100644
a
|
b
|
class Tests_Functions extends WP_UnitTestCase { |
2069 | 2069 | * @ticket 55505 |
2070 | 2070 | * @covers ::wp_recursive_ksort |
2071 | 2071 | */ |
2072 | | function test_wp_recursive_ksort() { |
| 2072 | public function test_wp_recursive_ksort() { |
2073 | 2073 | // Create an array to test. |
2074 | 2074 | $theme_json = array( |
2075 | 2075 | 'version' => 1, |
-
diff --git a/tests/phpunit/tests/kses.php b/tests/phpunit/tests/kses.php
index 294cb84779..84787a4501 100644
a
|
b
|
EOF; |
1647 | 1647 | * @param string $html A string of HTML to test. |
1648 | 1648 | * @param string $expected The expected result from KSES. |
1649 | 1649 | */ |
1650 | | function test_wp_kses_object_tag_allowed( $html, $expected ) { |
| 1650 | public function test_wp_kses_object_tag_allowed( $html, $expected ) { |
1651 | 1651 | $this->assertSame( $expected, wp_kses_post( $html ) ); |
1652 | 1652 | } |
1653 | 1653 | |
1654 | 1654 | /** |
1655 | 1655 | * Data provider for test_wp_kses_object_tag_allowed(). |
1656 | 1656 | */ |
1657 | | function data_wp_kses_object_tag_allowed() { |
| 1657 | public function data_wp_kses_object_tag_allowed() { |
1658 | 1658 | return array( |
1659 | 1659 | 'valid value for type' => array( |
1660 | 1660 | '<object type="application/pdf" data="https://example.org/foo.pdf" />', |
… |
… |
EOF; |
1757 | 1757 | * @param string $html A string of HTML to test. |
1758 | 1758 | * @param string $expected The expected result from KSES. |
1759 | 1759 | */ |
1760 | | function test_wp_kses_object_data_url_with_port_number_allowed( $html, $expected ) { |
| 1760 | public function test_wp_kses_object_data_url_with_port_number_allowed( $html, $expected ) { |
1761 | 1761 | add_filter( 'upload_dir', array( $this, 'wp_kses_upload_dir_filter' ), 10, 2 ); |
1762 | 1762 | $this->assertSame( $expected, wp_kses_post( $html ) ); |
1763 | 1763 | } |
… |
… |
EOF; |
1765 | 1765 | /** |
1766 | 1766 | * Data provider for test_wp_kses_object_data_url_with_port_number_allowed(). |
1767 | 1767 | */ |
1768 | | function data_wp_kses_object_data_url_with_port_number_allowed() { |
| 1768 | public function data_wp_kses_object_data_url_with_port_number_allowed() { |
1769 | 1769 | return array( |
1770 | 1770 | 'url with port number' => array( |
1771 | 1771 | '<object type="application/pdf" data="https://example.org:8888/cat/foo.pdf" />', |
… |
… |
EOF; |
1804 | 1804 | * |
1805 | 1805 | * @ticket 54261 |
1806 | 1806 | */ |
1807 | | function test_wp_kses_object_added_in_html_filter() { |
| 1807 | public function test_wp_kses_object_added_in_html_filter() { |
1808 | 1808 | $html = <<<HTML |
1809 | 1809 | <object type="application/pdf" data="https://wordpress.org/foo.pdf" /> |
1810 | 1810 | <object type="application/x-shockwave-flash" data="https://wordpress.org/foo.swf"> |
… |
… |
HTML; |
1821 | 1821 | $this->assertSame( $html, $filtered_html ); |
1822 | 1822 | } |
1823 | 1823 | |
1824 | | function filter_wp_kses_object_added_in_html_filter( $tags, $context ) { |
| 1824 | public function filter_wp_kses_object_added_in_html_filter( $tags, $context ) { |
1825 | 1825 | if ( 'post' === $context ) { |
1826 | 1826 | $tags['object'] = array( |
1827 | 1827 | 'type' => true, |
… |
… |
HTML; |
1848 | 1848 | * @param string $expected The expected result from KSES. |
1849 | 1849 | * @param array $allowed_html The allowed HTML to pass to KSES. |
1850 | 1850 | */ |
1851 | | function test_wp_kses_allowed_values_list( $html, $expected, $allowed_html ) { |
| 1851 | public function test_wp_kses_allowed_values_list( $html, $expected, $allowed_html ) { |
1852 | 1852 | $this->assertSame( $expected, wp_kses( $html, $allowed_html ) ); |
1853 | 1853 | } |
1854 | 1854 | |
1855 | 1855 | /** |
1856 | 1856 | * Data provider for test_wp_kses_allowed_values_list(). |
1857 | 1857 | */ |
1858 | | function data_wp_kses_allowed_values_list() { |
| 1858 | public function data_wp_kses_allowed_values_list() { |
1859 | 1859 | $data = array( |
1860 | 1860 | 'valid dir attribute value' => array( |
1861 | 1861 | '<p dir="ltr">foo</p>', |
… |
… |
HTML; |
1906 | 1906 | * @param string $expected The expected result from KSES. |
1907 | 1907 | * @param array $allowed_html The allowed HTML to pass to KSES. |
1908 | 1908 | */ |
1909 | | function test_wp_kses_required_attribute( $html, $expected, $allowed_html ) { |
| 1909 | public function test_wp_kses_required_attribute( $html, $expected, $allowed_html ) { |
1910 | 1910 | $this->assertSame( $expected, wp_kses( $html, $allowed_html ) ); |
1911 | 1911 | } |
1912 | 1912 | |
1913 | 1913 | /** |
1914 | 1914 | * Data provider for test_wp_kses_required_attribute(). |
1915 | 1915 | */ |
1916 | | function data_wp_kses_required_attribute() { |
| 1916 | public function data_wp_kses_required_attribute() { |
1917 | 1917 | $data = array( |
1918 | 1918 | 'valid dir attribute value' => array( |
1919 | 1919 | '<p dir="ltr">foo</p>', // Test HTML. |
-
diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php
index 3a8e6544d2..42cddc36b0 100644
a
|
b
|
EOF; |
3475 | 3475 | * |
3476 | 3476 | * @param string $context |
3477 | 3477 | */ |
3478 | | function test_wp_get_loading_attr_default( $context ) { |
| 3478 | public function test_wp_get_loading_attr_default( $context ) { |
3479 | 3479 | global $wp_query, $wp_the_query; |
3480 | 3480 | |
3481 | 3481 | // Return 'lazy' by default. |
… |
… |
EOF; |
3513 | 3513 | } |
3514 | 3514 | } |
3515 | 3515 | |
3516 | | function data_wp_get_loading_attr_default() { |
| 3516 | public function data_wp_get_loading_attr_default() { |
3517 | 3517 | return array( |
3518 | 3518 | array( 'the_content' ), |
3519 | 3519 | array( 'the_post_thumbnail' ), |
… |
… |
EOF; |
3523 | 3523 | /** |
3524 | 3524 | * @ticket 53675 |
3525 | 3525 | */ |
3526 | | function test_wp_omit_loading_attr_threshold_filter() { |
| 3526 | public function test_wp_omit_loading_attr_threshold_filter() { |
3527 | 3527 | global $wp_query, $wp_the_query; |
3528 | 3528 | |
3529 | 3529 | $wp_query = new WP_Query( array( 'post__in' => array( self::$post_ids['publish'] ) ) ); |
… |
… |
EOF; |
3555 | 3555 | /** |
3556 | 3556 | * @ticket 53675 |
3557 | 3557 | */ |
3558 | | function test_wp_filter_content_tags_with_wp_get_loading_attr_default() { |
| 3558 | public function test_wp_filter_content_tags_with_wp_get_loading_attr_default() { |
3559 | 3559 | global $wp_query, $wp_the_query; |
3560 | 3560 | |
3561 | 3561 | $img1 = get_image_tag( self::$large_id, '', '', '', 'large' ); |
-
diff --git a/tests/phpunit/tests/post/wpInsertPost.php b/tests/phpunit/tests/post/wpInsertPost.php
index 43811e0919..6560be1796 100644
a
|
b
|
class Tests_Post_wpInsertPost extends WP_UnitTestCase { |
877 | 877 | /** |
878 | 878 | * @ticket 19954 |
879 | 879 | */ |
880 | | function test_updating_a_post_should_not_trash_categories() { |
| 880 | public function test_updating_a_post_should_not_trash_categories() { |
881 | 881 | // Create a category and attach it to a new post. |
882 | 882 | $term_id = self::factory()->term->create( |
883 | 883 | array( |
-
diff --git a/tests/phpunit/tests/query/fieldsClause.php b/tests/phpunit/tests/query/fieldsClause.php
index d873857a65..87f78a8719 100644
a
|
b
|
class Tests_Query_FieldsClause extends WP_UnitTestCase { |
217 | 217 | * @param string $fields The fields to SELECT. |
218 | 218 | * @return string The filtered fields. |
219 | 219 | */ |
220 | | function filter_posts_fields( $fields ) { |
| 220 | public function filter_posts_fields( $fields ) { |
221 | 221 | return "$fields, 1 as test_post_fields"; |
222 | 222 | } |
223 | 223 | |
… |
… |
class Tests_Query_FieldsClause extends WP_UnitTestCase { |
227 | 227 | * @param array $clauses The WP_Query database clauses. |
228 | 228 | * @return array The filtered database clauses. |
229 | 229 | */ |
230 | | function filter_posts_clauses( $clauses ) { |
| 230 | public function filter_posts_clauses( $clauses ) { |
231 | 231 | $clauses['fields'] .= ', 2 as test_post_clauses'; |
232 | 232 | return $clauses; |
233 | 233 | } |
-
diff --git a/tests/phpunit/tests/theme/wpThemeJson.php b/tests/phpunit/tests/theme/wpThemeJson.php
index 5fa8a15de9..e07e5f2486 100644
a
|
b
|
class Tests_Theme_wpThemeJson extends WP_UnitTestCase { |
201 | 201 | $this->assertEqualSetsWithIndex( $expected_no_origin, $actual_no_origin ); |
202 | 202 | } |
203 | 203 | |
204 | | function test_get_settings_appearance_true_opts_in() { |
| 204 | public function test_get_settings_appearance_true_opts_in() { |
205 | 205 | $theme_json = new WP_Theme_JSON( |
206 | 206 | array( |
207 | 207 | 'version' => WP_Theme_JSON::LATEST_SCHEMA, |
… |
… |
class Tests_Theme_wpThemeJson extends WP_UnitTestCase { |
280 | 280 | $this->assertEqualSetsWithIndex( $expected, $actual ); |
281 | 281 | } |
282 | 282 | |
283 | | function test_get_settings_appearance_false_does_not_opt_in() { |
| 283 | public function test_get_settings_appearance_false_does_not_opt_in() { |
284 | 284 | $theme_json = new WP_Theme_JSON( |
285 | 285 | array( |
286 | 286 | 'version' => WP_Theme_JSON::LATEST_SCHEMA, |
… |
… |
class Tests_Theme_wpThemeJson extends WP_UnitTestCase { |
2734 | 2734 | /** |
2735 | 2735 | * @ticket 55505 |
2736 | 2736 | */ |
2737 | | function test_export_data() { |
| 2737 | public function test_export_data() { |
2738 | 2738 | $theme = new WP_Theme_JSON( |
2739 | 2739 | array( |
2740 | 2740 | 'version' => 2, |
… |
… |
class Tests_Theme_wpThemeJson extends WP_UnitTestCase { |
2812 | 2812 | /** |
2813 | 2813 | * @ticket 55505 |
2814 | 2814 | */ |
2815 | | function test_export_data_deals_with_empty_user_data() { |
| 2815 | public function test_export_data_deals_with_empty_user_data() { |
2816 | 2816 | $theme = new WP_Theme_JSON( |
2817 | 2817 | array( |
2818 | 2818 | 'version' => 2, |
… |
… |
class Tests_Theme_wpThemeJson extends WP_UnitTestCase { |
2862 | 2862 | /** |
2863 | 2863 | * @ticket 55505 |
2864 | 2864 | */ |
2865 | | function test_export_data_deals_with_empty_theme_data() { |
| 2865 | public function test_export_data_deals_with_empty_theme_data() { |
2866 | 2866 | $user = new WP_Theme_JSON( |
2867 | 2867 | array( |
2868 | 2868 | 'version' => 2, |
… |
… |
class Tests_Theme_wpThemeJson extends WP_UnitTestCase { |
2913 | 2913 | /** |
2914 | 2914 | * @ticket 55505 |
2915 | 2915 | */ |
2916 | | function test_export_data_deals_with_empty_data() { |
| 2916 | public function test_export_data_deals_with_empty_data() { |
2917 | 2917 | $theme_v2 = new WP_Theme_JSON( |
2918 | 2918 | array( |
2919 | 2919 | 'version' => 2, |
… |
… |
class Tests_Theme_wpThemeJson extends WP_UnitTestCase { |
2938 | 2938 | /** |
2939 | 2939 | * @ticket 55505 |
2940 | 2940 | */ |
2941 | | function test_export_data_sets_appearance_tools() { |
| 2941 | public function test_export_data_sets_appearance_tools() { |
2942 | 2942 | $theme = new WP_Theme_JSON( |
2943 | 2943 | array( |
2944 | 2944 | 'version' => 2, |
… |
… |
class Tests_Theme_wpThemeJson extends WP_UnitTestCase { |
2972 | 2972 | /** |
2973 | 2973 | * @ticket 56611 |
2974 | 2974 | */ |
2975 | | function test_export_data_sets_use_root_padding_aware_alignments() { |
| 2975 | public function test_export_data_sets_use_root_padding_aware_alignments() { |
2976 | 2976 | $theme = new WP_Theme_JSON( |
2977 | 2977 | array( |
2978 | 2978 | 'version' => 2, |
… |
… |
class Tests_Theme_wpThemeJson extends WP_UnitTestCase { |
3505 | 3505 | /** |
3506 | 3506 | * @ticket 56467 |
3507 | 3507 | */ |
3508 | | function test_get_styles_for_block_with_padding_aware_alignments() { |
| 3508 | public function test_get_styles_for_block_with_padding_aware_alignments() { |
3509 | 3509 | $theme_json = new WP_Theme_JSON( |
3510 | 3510 | array( |
3511 | 3511 | 'version' => 2, |
… |
… |
class Tests_Theme_wpThemeJson extends WP_UnitTestCase { |
3539 | 3539 | /** |
3540 | 3540 | * @ticket 56467 |
3541 | 3541 | */ |
3542 | | function test_get_styles_for_block_without_padding_aware_alignments() { |
| 3542 | public function test_get_styles_for_block_without_padding_aware_alignments() { |
3543 | 3543 | $theme_json = new WP_Theme_JSON( |
3544 | 3544 | array( |
3545 | 3545 | 'version' => 2, |
… |
… |
class Tests_Theme_wpThemeJson extends WP_UnitTestCase { |
3570 | 3570 | /** |
3571 | 3571 | * @ticket 56467 |
3572 | 3572 | */ |
3573 | | function test_get_styles_for_block_with_content_width() { |
| 3573 | public function test_get_styles_for_block_with_content_width() { |
3574 | 3574 | $theme_json = new WP_Theme_JSON( |
3575 | 3575 | array( |
3576 | 3576 | 'version' => 2, |
… |
… |
class Tests_Theme_wpThemeJson extends WP_UnitTestCase { |
3597 | 3597 | /** |
3598 | 3598 | * @ticket 56611 |
3599 | 3599 | */ |
3600 | | function test_get_styles_with_appearance_tools() { |
| 3600 | public function test_get_styles_with_appearance_tools() { |
3601 | 3601 | $theme_json = new WP_Theme_JSON( |
3602 | 3602 | array( |
3603 | 3603 | 'version' => 2, |
… |
… |
class Tests_Theme_wpThemeJson extends WP_UnitTestCase { |
3627 | 3627 | * @param array $spacing_scale Example spacing scale definitions from the data provider. |
3628 | 3628 | * @param array $expected_output Expected output from data provider. |
3629 | 3629 | */ |
3630 | | function test_should_set_spacing_sizes( $spacing_scale, $expected_output ) { |
| 3630 | public function test_should_set_spacing_sizes( $spacing_scale, $expected_output ) { |
3631 | 3631 | $theme_json = new WP_Theme_JSON( |
3632 | 3632 | array( |
3633 | 3633 | 'version' => 2, |
… |
… |
class Tests_Theme_wpThemeJson extends WP_UnitTestCase { |
3650 | 3650 | * |
3651 | 3651 | * @return array |
3652 | 3652 | */ |
3653 | | function data_generate_spacing_scale_fixtures() { |
| 3653 | public function data_generate_spacing_scale_fixtures() { |
3654 | 3654 | return array( |
3655 | 3655 | 'only one value when single step in spacing scale' => array( |
3656 | 3656 | 'spacing_scale' => array( |
… |
… |
class Tests_Theme_wpThemeJson extends WP_UnitTestCase { |
3944 | 3944 | * |
3945 | 3945 | * @return array |
3946 | 3946 | */ |
3947 | | function data_set_spacing_sizes_when_invalid() { |
| 3947 | public function data_set_spacing_sizes_when_invalid() { |
3948 | 3948 | return array( |
3949 | 3949 | 'missing operator value' => array( |
3950 | 3950 | 'spacing_scale' => array( |
… |
… |
class Tests_Theme_wpThemeJson extends WP_UnitTestCase { |
4032 | 4032 | * |
4033 | 4033 | * @return array |
4034 | 4034 | */ |
4035 | | function data_update_separator_declarations() { |
| 4035 | public function data_update_separator_declarations() { |
4036 | 4036 | return array( |
4037 | 4037 | // If only background is defined, test that includes border-color to the style so it is applied on the front end. |
4038 | 4038 | 'only background' => array( |
-
diff --git a/tests/phpunit/tests/theme/wpThemeJsonResolver.php b/tests/phpunit/tests/theme/wpThemeJsonResolver.php
index 359bf58d00..8eaac663b0 100644
a
|
b
|
class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase { |
450 | 450 | /** |
451 | 451 | * @ticket 54336 |
452 | 452 | */ |
453 | | function test_add_theme_supports_are_loaded_for_themes_without_theme_json() { |
| 453 | public function test_add_theme_supports_are_loaded_for_themes_without_theme_json() { |
454 | 454 | switch_theme( 'default' ); |
455 | 455 | $color_palette = array( |
456 | 456 | array( |
… |
… |
class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase { |
498 | 498 | * @ticket 54336 |
499 | 499 | * @ticket 56611 |
500 | 500 | */ |
501 | | function test_merges_child_theme_json_into_parent_theme_json() { |
| 501 | public function test_merges_child_theme_json_into_parent_theme_json() { |
502 | 502 | switch_theme( 'block-theme-child' ); |
503 | 503 | |
504 | 504 | $actual_settings = WP_Theme_JSON_Resolver::get_theme_data()->get_settings(); |
… |
… |
class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase { |
619 | 619 | /** |
620 | 620 | * @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles |
621 | 621 | */ |
622 | | function test_get_user_data_from_wp_global_styles_does_not_use_uncached_queries() { |
| 622 | public function test_get_user_data_from_wp_global_styles_does_not_use_uncached_queries() { |
623 | 623 | // Switch to a theme that does have support. |
624 | 624 | switch_theme( 'block-theme' ); |
625 | 625 | wp_set_current_user( self::$administrator_id ); |
… |
… |
class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase { |
659 | 659 | /** |
660 | 660 | * @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles |
661 | 661 | */ |
662 | | function test_get_user_data_from_wp_global_styles_does_not_use_uncached_queries_for_logged_out_users() { |
| 662 | public function test_get_user_data_from_wp_global_styles_does_not_use_uncached_queries_for_logged_out_users() { |
663 | 663 | // Switch to a theme that does have support. |
664 | 664 | switch_theme( 'block-theme' ); |
665 | 665 | $theme = wp_get_theme(); |
… |
… |
class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase { |
680 | 680 | * @ticket 56945 |
681 | 681 | * @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles |
682 | 682 | */ |
683 | | function test_get_user_data_from_wp_global_styles_does_not_run_for_theme_without_support() { |
| 683 | public function test_get_user_data_from_wp_global_styles_does_not_run_for_theme_without_support() { |
684 | 684 | // The 'default' theme does not support theme.json. |
685 | 685 | switch_theme( 'default' ); |
686 | 686 | wp_set_current_user( self::$administrator_id ); |
… |
… |
class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase { |
702 | 702 | * @ticket 55392 |
703 | 703 | * @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles |
704 | 704 | */ |
705 | | function test_get_user_data_from_wp_global_styles_does_exist() { |
| 705 | public function test_get_user_data_from_wp_global_styles_does_exist() { |
706 | 706 | // Switch to a theme that does have support. |
707 | 707 | switch_theme( 'block-theme' ); |
708 | 708 | $theme = wp_get_theme(); |
… |
… |
class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase { |
719 | 719 | * @ticket 55392 |
720 | 720 | * @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles |
721 | 721 | */ |
722 | | function test_get_user_data_from_wp_global_styles_create_post() { |
| 722 | public function test_get_user_data_from_wp_global_styles_create_post() { |
723 | 723 | // Switch to a theme that does have support. |
724 | 724 | switch_theme( 'block-theme' ); |
725 | 725 | $theme = wp_get_theme( 'testing' ); |
… |
… |
class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase { |
738 | 738 | * @ticket 55392 |
739 | 739 | * @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles |
740 | 740 | */ |
741 | | function test_get_user_data_from_wp_global_styles_filter_state() { |
| 741 | public function test_get_user_data_from_wp_global_styles_filter_state() { |
742 | 742 | // Switch to a theme that does have support. |
743 | 743 | switch_theme( 'block-theme' ); |
744 | 744 | $theme = wp_get_theme( 'foo' ); |
… |
… |
class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase { |
754 | 754 | * @ticket 56835 |
755 | 755 | * @covers WP_Theme_JSON_Resolver::get_theme_data |
756 | 756 | */ |
757 | | function test_get_theme_data_theme_supports_overrides_theme_json() { |
| 757 | public function test_get_theme_data_theme_supports_overrides_theme_json() { |
758 | 758 | // Test that get_theme_data() returns a WP_Theme_JSON object. |
759 | 759 | $theme_json_resolver = new WP_Theme_JSON_Resolver(); |
760 | 760 | $theme_data = $theme_json_resolver->get_theme_data(); |
… |
… |
class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase { |
777 | 777 | * @ticket 56945 |
778 | 778 | * @covers WP_Theme_JSON_Resolver::get_theme_data |
779 | 779 | */ |
780 | | function test_get_theme_data_does_not_parse_theme_json_if_not_present() { |
| 780 | public function test_get_theme_data_does_not_parse_theme_json_if_not_present() { |
781 | 781 | // The 'default' theme does not support theme.json. |
782 | 782 | switch_theme( 'default' ); |
783 | 783 | |
-
diff --git a/tests/phpunit/tests/theme/wpThemeJsonSchema.php b/tests/phpunit/tests/theme/wpThemeJsonSchema.php
index 25cfcf7c97..e93ef0673a 100644
a
|
b
|
class Tests_Theme_wpThemeJsonSchema extends WP_UnitTestCase { |
19 | 19 | /** |
20 | 20 | * @ticket 54336 |
21 | 21 | */ |
22 | | function test_migrate_v1_to_v2() { |
| 22 | public function test_migrate_v1_to_v2() { |
23 | 23 | $theme_json_v1 = array( |
24 | 24 | 'version' => 1, |
25 | 25 | 'settings' => array( |
-
diff --git a/tests/phpunit/tests/user/query.php b/tests/phpunit/tests/user/query.php
index 03bb0f9633..ac9678a908 100644
a
|
b
|
class Tests_User_Query extends WP_UnitTestCase { |
2010 | 2010 | * |
2011 | 2011 | * @return array |
2012 | 2012 | */ |
2013 | | function data_returning_field_subset_as_string() { |
| 2013 | public function data_returning_field_subset_as_string() { |
2014 | 2014 | $data = array( |
2015 | 2015 | 'id' => array( |
2016 | 2016 | 'fields' => 'id', |
… |
… |
class Tests_User_Query extends WP_UnitTestCase { |
2092 | 2092 | * |
2093 | 2093 | * @return array |
2094 | 2094 | */ |
2095 | | function data_returning_field_subset_as_array() { |
| 2095 | public function data_returning_field_subset_as_array() { |
2096 | 2096 | $data = array( |
2097 | 2097 | 'id' => array( |
2098 | 2098 | 'fields' => array( 'id' ), |
-
diff --git a/tests/phpunit/tests/widgets.php b/tests/phpunit/tests/widgets.php
index 007cf3665a..fd3826ec3d 100644
a
|
b
|
class Tests_Widgets extends WP_UnitTestCase { |
589 | 589 | /** |
590 | 590 | * @ticket 52728 |
591 | 591 | */ |
592 | | function test_widget_display_callback_handles_arrayobject() { |
| 592 | public function test_widget_display_callback_handles_arrayobject() { |
593 | 593 | $widget = new WP_Widget_Text(); |
594 | 594 | |
595 | 595 | register_widget( $widget ); |