Skip to content

Commit da97bec

Browse files
committed
Tests: Make post, comment and term data providers static.
Declare eight data providers in the post, comment, category, taxonomy and term tests as `public static` for compatibility with newer PHPUnit versions. Preserve their datasets and assertions. Developed in: #14622, #14623, #14624, #14788, #14791, #14801, #14805 Props shailu25, mukesh27. See #66211. git-svn-id: https://develop.svn.wordpress.org/trunk@64743 602fd350-edb4-49c9-b593-d223f7449a82
1 parent f43551e commit da97bec

7 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎tests/phpunit/tests/category/walkerCategory.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static function ( $atts ) use ( $value ) {
5656
$this->assertSame( "<li class=\"cat-item cat-item-{$category->term_id}\"><a href=\"{$link}\"{$expected}>{$category->name}</a>", trim( $output ) );
5757
}
5858

59-
public function data_start_el_with_empty_attributes() {
59+
public static function data_start_el_with_empty_attributes() {
6060
return array(
6161
array(
6262
'',

‎tests/phpunit/tests/comment/getLastCommentModified.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public function test_internal_comment_types_are_excluded( $timezone, $expected )
176176
*
177177
* @return array<string, array{ timezone: string, expected: string }>
178178
*/
179-
public function data_internal_comment_types_are_excluded() {
179+
public static function data_internal_comment_types_are_excluded() {
180180
return array(
181181
'server timezone' => array(
182182
'timezone' => 'server',

‎tests/phpunit/tests/post/truncatePostSlug.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function test_truncate_post_slug_should_truncate( $slug, $length, $expect
3131
*
3232
* @return array[]
3333
*/
34-
public function data_truncate_post_slug_should_truncate() {
34+
public static function data_truncate_post_slug_should_truncate() {
3535
return array(
3636
'a slug that is too long' => array(
3737
'slug' => 'truncated slug',

‎tests/phpunit/tests/post/wpCountAttachments.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static function () use ( $value ) {
142142
*
143143
* @return array<non-falsy-string, array{ 0: mixed }>
144144
*/
145-
public function data_non_stdclass_values(): array {
145+
public static function data_non_stdclass_values(): array {
146146
return array(
147147
'array' => array( array( 'image/jpeg' => 42 ) ),
148148
'false' => array( false ),

‎tests/phpunit/tests/post/wpCountPosts.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static function () use ( $value ) {
6969
*
7070
* @return array<non-falsy-string, array{ 0: mixed }>
7171
*/
72-
public function data_non_stdclass_values(): array {
72+
public static function data_non_stdclass_values(): array {
7373
return array(
7474
'array' => array( array( 'publish' => 42 ) ),
7575
'false' => array( false ),

‎tests/phpunit/tests/taxonomy.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function test_taxonomy_exists_should_return_false_with_non_string_taxonom
174174
*
175175
* @return array
176176
*/
177-
public function data_taxonomy_exists_should_return_false_with_non_string_taxonomy() {
177+
public static function data_taxonomy_exists_should_return_false_with_non_string_taxonomy() {
178178
return array(
179179
'array' => array( array() ),
180180
'object' => array( new stdClass() ),

‎tests/phpunit/tests/term.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public function test_wp_set_term_objects_finds_term_name_with_special_characters
300300
*
301301
* @return array
302302
*/
303-
public function data_wp_set_term_objects_finds_term_name_with_special_characters() {
303+
public static function data_wp_set_term_objects_finds_term_name_with_special_characters() {
304304
return array(
305305
'ampersand' => array( 'name' => 'Foo & Bar' ),
306306
'ndash and mdash' => array( 'name' => 'Foo – Bar' ),
@@ -406,7 +406,7 @@ static function () use ( $cat ) {
406406
*
407407
* @return array[]
408408
*/
409-
public function data_get_term_filter() {
409+
public static function data_get_term_filter() {
410410
return self::text_array_to_dataprovider( array( 'edit', 'db', 'display', 'attribute', 'js', 'rss', 'raw' ) );
411411
}
412412
}

0 commit comments

Comments
 (0)