Skip to content

Commit b65c057

Browse files
committed
Tests: Make comment test data providers static.
Declare the data providers in `tests/phpunit/tests/comment/` as `public static` for compatibility with newer PHPUnit versions. Preserve their datasets and assertions. Developed in: #14393 Props rejaulalomkhan. See #66211. git-svn-id: https://develop.svn.wordpress.org/trunk@64444 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 05d314a commit b65c057

11 files changed

Lines changed: 12 additions & 12 deletions

‎tests/phpunit/tests/comment/checkComment.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ static function ( $approve, $source_id ) use ( &$observed ) {
410410
*
411411
* @return array[]
412412
*/
413-
public function data_ping_types() {
413+
public static function data_ping_types() {
414414
return array(
415415
'pingback' => array( 'pingback' ),
416416
'trackback' => array( 'trackback' ),

‎tests/phpunit/tests/comment/commentTime.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function test_should_output_the_same_value_that_get_comment_time_returns(
6868
*
6969
* @return array[]
7070
*/
71-
public function data_should_output_the_same_value_that_get_comment_time_returns() {
71+
public static function data_should_output_the_same_value_that_get_comment_time_returns() {
7272
return array(
7373
'an empty format' => array(
7474
'format' => '',

‎tests/phpunit/tests/comment/commentsTemplate.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ static function ( $args ) use ( $top_level_query_args ) {
10481048
$this->assertSame( $expected['offset'], $offset );
10491049
}
10501050

1051-
public function data_comments_template_top_level_query_args() {
1051+
public static function data_comments_template_top_level_query_args() {
10521052
return array(
10531053
array(
10541054
array(

‎tests/phpunit/tests/comment/getCommentAuthor.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function test_should_return_author_when_given_object_without_comment_id(
8282
*
8383
* @return array
8484
*/
85-
public function data_should_return_author_when_given_object_without_comment_id() {
85+
public static function data_should_return_author_when_given_object_without_comment_id() {
8686
return array(
8787
'with no author' => array(
8888
'comment_props' => new stdClass(),

‎tests/phpunit/tests/comment/getCommentAuthorLink.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function test_should_return_author_when_given_object_without_comment_id(
8383
*
8484
* @return array
8585
*/
86-
public function data_should_return_author_when_given_object_without_comment_id() {
86+
public static function data_should_return_author_when_given_object_without_comment_id() {
8787
return array(
8888
'with no author' => array(
8989
'comment_props' => new stdClass(),

‎tests/phpunit/tests/comment/isAvatarCommentType.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function test_function( $comment_type, $expected ) {
3434
* }
3535
* }
3636
*/
37-
public function data_is_avatar_comment_type() {
37+
public static function data_is_avatar_comment_type() {
3838
return array(
3939
array( null, false ),
4040
array( '', false ),

‎tests/phpunit/tests/comment/query.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5507,7 +5507,7 @@ static function ( int $comment_id ): string {
55075507
*
55085508
* @return array<string, array{ query_args: array<string, string|array>, expected_types: string[] }>
55095509
*/
5510-
public function data_note_type_exclusion(): array {
5510+
public static function data_note_type_exclusion(): array {
55115511
return array(
55125512
'default query excludes note' => array(
55135513
'query_args' => array(),

‎tests/phpunit/tests/comment/template.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function enable_comment_number_declension( $translation, $text, $context,
133133
* }
134134
* }
135135
*/
136-
public function data_get_comments_number_text_declension() {
136+
public static function data_get_comments_number_text_declension() {
137137
return array(
138138
array(
139139
2,

‎tests/phpunit/tests/comment/wpAllowComment.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function test_should_approve_a_pingback_only_when_it_comes_from_this_site
108108
*
109109
* @return array[]
110110
*/
111-
public function data_should_approve_a_pingback_only_when_it_comes_from_this_site() {
111+
public static function data_should_approve_a_pingback_only_when_it_comes_from_this_site() {
112112
return array(
113113
'a pingback from this site' => array( true, 1 ),
114114
'a pingback from another site' => array( false, 0 ),

‎tests/phpunit/tests/comment/wpComment.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function test_get_instance_replaces_a_poisoned_cache_value( $cache_value
115115
*
116116
* @return array<non-falsy-string, array{ mixed }>
117117
*/
118-
public function data_get_instance_treats_a_poisoned_cache_value_as_a_cache_miss(): array {
118+
public static function data_get_instance_treats_a_poisoned_cache_value_as_a_cache_miss(): array {
119119
return array(
120120
'true' => array( true ),
121121
'a non-numeric string' => array( 'not-a-comment' ),

0 commit comments

Comments
 (0)