Skip to content

Commit f53c754

Browse files
committed
Tests: Make REST API data providers static.
Declare the remaining 13 data providers in `tests/phpunit/tests/rest-api.php` as `public static` for PHPUnit compatibility. Preserve existing datasets and assertions. Developed in: #15299 Props rejaulalomkhan, huzaifaalmesbah. See #66211. git-svn-id: https://develop.svn.wordpress.org/trunk@65127 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 16790ba commit f53c754

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

‎tests/phpunit/tests/rest-api.php‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ public function test_jsonp_callback_check( $callback, $expected ) {
991991
$this->assertSame( $expected, wp_check_jsonp_callback( $callback ) );
992992
}
993993

994-
public function data_jsonp_callback_check() {
994+
public static function data_jsonp_callback_check() {
995995
return array(
996996
// Standard names.
997997
array( 'Springfield', true ),
@@ -1016,7 +1016,7 @@ public function test_rest_parse_date( $date, $expected ) {
10161016
$this->assertSame( $expected, rest_parse_date( $date ) );
10171017
}
10181018

1019-
public function data_rest_parse_date() {
1019+
public static function data_rest_parse_date() {
10201020
return array(
10211021
// Valid dates with timezones.
10221022
array( '2017-01-16T11:30:00-05:00', gmmktime( 11, 30, 0, 1, 16, 2017 ) + 5 * HOUR_IN_SECONDS ),
@@ -1048,7 +1048,7 @@ public function test_rest_parse_date_force_utc( $date, $expected ) {
10481048
$this->assertSame( $expected, rest_parse_date( $date, true ) );
10491049
}
10501050

1051-
public function data_rest_parse_date_force_utc() {
1051+
public static function data_rest_parse_date_force_utc() {
10521052
return array(
10531053
// Valid dates with timezones.
10541054
array( '2017-01-16T11:30:00-05:00', gmmktime( 11, 30, 0, 1, 16, 2017 ) ),
@@ -1162,7 +1162,7 @@ public function test_rest_parse_embed_param( $expected, $embed ) {
11621162
$this->assertSame( $expected, rest_parse_embed_param( $embed ) );
11631163
}
11641164

1165-
public function data_rest_parse_embed_param() {
1165+
public static function data_rest_parse_embed_param() {
11661166
return array(
11671167
array( true, '' ),
11681168
array( true, null ),
@@ -1280,7 +1280,7 @@ public function test_register_route_with_missing_permission_callback_multiple_wr
12801280
$this->assertTrue( $registered );
12811281
}
12821282

1283-
public function data_rest_filter_response_by_context() {
1283+
public static function data_rest_filter_response_by_context() {
12841284
return array(
12851285
'default' => array(
12861286
array(
@@ -1973,7 +1973,7 @@ public function test_rest_ensure_response_returns_instance_of_wp_rest_response(
19731973
*
19741974
* @return array
19751975
*/
1976-
public function data_rest_ensure_response_returns_instance_of_wp_rest_response() {
1976+
public static function data_rest_ensure_response_returns_instance_of_wp_rest_response() {
19771977
return array(
19781978
array( null, null ),
19791979
array( array( 'chocolate' => 'cookies' ), array( 'chocolate' => 'cookies' ) ),
@@ -2198,7 +2198,7 @@ public function test_rest_is_object( $expected, $value ) {
21982198
}
21992199
}
22002200

2201-
public function data_rest_is_object() {
2201+
public static function data_rest_is_object() {
22022202
return array(
22032203
array(
22042204
true,
@@ -2256,7 +2256,7 @@ public function test_rest_sanitize_object( $expected, $value ) {
22562256
$this->assertSame( $expected, $sanitized );
22572257
}
22582258

2259-
public function data_rest_sanitize_object() {
2259+
public static function data_rest_sanitize_object() {
22602260
return array(
22612261
array(
22622262
array(),
@@ -2319,7 +2319,7 @@ public function test_rest_is_array( $expected, $value ) {
23192319
}
23202320
}
23212321

2322-
public function data_rest_is_array() {
2322+
public static function data_rest_is_array() {
23232323
return array(
23242324
array(
23252325
true,
@@ -2385,7 +2385,7 @@ public function test_rest_sanitize_array( $expected, $value ) {
23852385
$this->assertSame( $expected, $sanitized );
23862386
}
23872387

2388-
public function data_rest_sanitize_array() {
2388+
public static function data_rest_sanitize_array() {
23892389
return array(
23902390
array(
23912391
array(),
@@ -2502,7 +2502,7 @@ public function test_rest_is_integer( bool $expected_is_integer, $value, ?int $e
25022502
* 2?: int, // $expected_sanitized
25032503
* }>
25042504
*/
2505-
public function data_rest_is_integer(): array {
2505+
public static function data_rest_is_integer(): array {
25062506
return array(
25072507
array(
25082508
true,
@@ -2720,7 +2720,7 @@ public function test_get_best_type_for_value( $expected, $value, $types ) {
27202720
$this->assertSame( $expected, rest_get_best_type_for_value( $value, $types ) );
27212721
}
27222722

2723-
public function data_get_best_type_for_value() {
2723+
public static function data_get_best_type_for_value() {
27242724
return array(
27252725
array(
27262726
'array',
@@ -2856,7 +2856,7 @@ public function test_rest_preload_api_request_embeds_links( $embed, $expected, $
28562856
}
28572857
}
28582858

2859-
public function data_rest_preload_api_request_embeds_links() {
2859+
public static function data_rest_preload_api_request_embeds_links() {
28602860
return array(
28612861
array( '_embed=wp:term,author', array( 'wp:term', 'author' ), array( 'replies' ) ),
28622862
array( '_embed[]=wp:term&_embed[]=author', array( 'wp:term', 'author' ), array( 'replies' ) ),

0 commit comments

Comments
 (0)