Skip to content

Commit 2957830

Browse files
committed
Tests: Make block and HTML-tree data providers static.
Declare nine existing data providers in the block-binding, HTML-tree comparison and block-template tests as `public static`. Preserve their datasets and assertions for compatibility with newer PHPUnit versions. Developed in: #15231, #15232, #15233 Props devmuhib, huzaifaalmesbah. See #66211. git-svn-id: https://develop.svn.wordpress.org/trunk@65070 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 075aca2 commit 2957830

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎tests/phpunit/tests/block-bindings/render.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static function wpTearDownAfterClass() {
7878
unregister_block_type( 'test/block' );
7979
}
8080

81-
public function data_update_block_with_value_from_source() {
81+
public static function data_update_block_with_value_from_source() {
8282
return array(
8383
'paragraph block' => array(
8484
'content',
@@ -180,7 +180,7 @@ public function test_update_block_with_value_from_source( $bound_attribute, $blo
180180
);
181181
}
182182

183-
public function data_different_get_value_callbacks() {
183+
public static function data_different_get_value_callbacks() {
184184
return array(
185185
'pass arguments to source' => array(
186186
function ( $source_args, $block_instance, $attribute_name ) {
@@ -533,7 +533,7 @@ public function test_filter_block_bindings_source_value() {
533533
*
534534
* @return array[]
535535
*/
536-
public function data_rich_text_binding_preserves_nested_inner_blocks() {
536+
public static function data_rich_text_binding_preserves_nested_inner_blocks() {
537537
$child_list = self::build_list_block(
538538
array(
539539
self::build_list_item_block( 'Nested child' ),

‎tests/phpunit/tests/block-template.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ public function test_get_the_block_template_html_does_not_add_skip_link_when_act
382382
*
383383
* @return array<string, array<string, string>>
384384
*/
385-
public function data_provider_skip_link_actions(): array {
385+
public static function data_provider_skip_link_actions(): array {
386386
return array(
387387
'the_block_template_skip_link' => array(
388388
'action' => 'wp_footer',
@@ -428,7 +428,7 @@ public function test_get_block_theme_folders( $theme, $expected ) {
428428
*
429429
* @return array[]
430430
*/
431-
public function data_get_block_theme_folders() {
431+
public static function data_get_block_theme_folders() {
432432
return array(
433433
'block-theme' => array(
434434
'block-theme',
@@ -596,7 +596,7 @@ static function () use ( $theme_dir ) {
596596
*
597597
* @return array<string, array{theme_directory: string, template_type: string, expected_slugs: string[]}>
598598
*/
599-
public function data_get_block_templates_files_slugs() {
599+
public static function data_get_block_templates_files_slugs() {
600600
return array(
601601
'template parts in a theme whose directory name does not end with parts' => array(
602602
'theme_directory' => 'default',

‎tests/phpunit/tests/build-visual-html-tree.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @group testsuite
99
*/
1010
class Tests_Build_Equivalent_HTML_Semantic_Tree extends WP_UnitTestCase {
11-
public function data_build_equivalent_html_semantic_tree() {
11+
public static function data_build_equivalent_html_semantic_tree() {
1212
$block_markup = <<<'HTML'
1313
<!-- wp:separator {"className":"is-style-default has-custom-classname","style":{"spacing":{"margin":{"top":"50px","bottom":"50px"}}},"backgroundColor":"accent-1"} -->
1414
<hr class="wp-block-separator is-style-default has-custom-classname" style="margin-top: 50px; margin-bottom: 50px" />
@@ -100,7 +100,7 @@ public function test_build_equivalent_html_semantic_tree( $markup, $expected ) {
100100
$this->assertSame( $expected, $actual );
101101
}
102102

103-
public function data_build_equivalent_html_semantic_tree_with_equivalent_html() {
103+
public static function data_build_equivalent_html_semantic_tree_with_equivalent_html() {
104104
return array(
105105
'Different attribute order' => array(
106106
'<img src="wp.png" alt="The WordPress logo">',
@@ -151,7 +151,7 @@ public function test_build_equivalent_html_semantic_tree_with_equivalent_html( $
151151
$this->assertSame( $tree_expected, $tree_actual );
152152
}
153153

154-
public function data_build_equivalent_html_semantic_tree_with_non_equivalent_html() {
154+
public static function data_build_equivalent_html_semantic_tree_with_non_equivalent_html() {
155155
return array(
156156
'Different attributes' => array(
157157
'<img src="wp.png" alt="The WordPress logo">',

0 commit comments

Comments
 (0)