Skip to content

Commit 4b28542

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

8 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎tests/phpunit/tests/date/currentTime.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public function test_should_return_correct_local_time( $timezone ) {
145145
*
146146
* @return array[]
147147
*/
148-
public function data_timezones() {
148+
public static function data_timezones() {
149149
return array(
150150
array( 'Europe/Helsinki' ),
151151
array( 'Indian/Antananarivo' ),
@@ -255,7 +255,7 @@ public function test_partial_hour_timezones_match_datetime_offset( $partial_hour
255255
*
256256
* @return array[]
257257
*/
258-
public function data_partial_hour_timezones_with_timestamp() {
258+
public static function data_partial_hour_timezones_with_timestamp() {
259259
return array(
260260
'+12:45' => array( 12.75, 'Pacific/Chatham' ), // New Zealand, Chatham Islands.
261261
'+9:30' => array( 9.5, 'Australia/Darwin' ), // Australian Northern Territory.

‎tests/phpunit/tests/date/dateI18n.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function test_date_i18n_handles_shorthand_formats( $short, $full ) {
151151
$this->assertSame( $short, date_i18n( '\\' . $short ) );
152152
}
153153

154-
public function data_formats() {
154+
public static function data_formats() {
155155
return array(
156156
array(
157157
'c',
@@ -216,7 +216,7 @@ public function test_should_handle_dst( $time, $timezone ) {
216216
$this->assertSame( $datetime->format( $format ), date_i18n( $format, $wp_timestamp ) );
217217
}
218218

219-
public function data_should_handle_dst() {
219+
public static function data_should_handle_dst() {
220220
return array(
221221
'Before DST start' => array( '2019-03-31 02:59:00', 'Europe/Helsinki' ),
222222
'After DST start' => array( '2019-03-31 04:01:00', 'Europe/Helsinki' ),

‎tests/phpunit/tests/date/getFeedBuildDate.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public function test_should_return_correct_build_date_for_cold_query_fields( str
178178
*
179179
* @return array<non-falsy-string, array{ non-falsy-string }>
180180
*/
181-
public function data_cold_post_query_fields(): array {
181+
public static function data_cold_post_query_fields(): array {
182182
return array(
183183
'IDs' => array( 'ids' ),
184184
'partial' => array( 'id=>parent' ),

‎tests/phpunit/tests/date/maybeDeclineDate.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function filter__enable_months_names_declension( $translation, $text, $co
7171
return $translation;
7272
}
7373

74-
public function data_wp_maybe_decline_date() {
74+
public static function data_wp_maybe_decline_date() {
7575
return array(
7676
array( 'ru_RU', 'j F', '21 Июнь', '21 июня' ),
7777
array( 'ru_RU', 'j F Y', '1 Январь 2016', '1 января 2016' ),

‎tests/phpunit/tests/date/query.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ public function test_build_mysql_datetime( $datetime, $expected, $default_to_max
548548
$this->assertEqualsWithDelta( strtotime( $expected ), strtotime( $found ), 10, $message );
549549
}
550550

551-
public function data_build_mysql_datetime() {
551+
public static function data_build_mysql_datetime() {
552552
return array(
553553
array( '2019-06-04T08:18:24+03:00', '2019-06-04 05:18:24' ),
554554
array( '2019-06-04T05:18:24+00:00', '2019-06-04 05:18:24' ),
@@ -583,7 +583,7 @@ public function test_build_mysql_datetime_with_custom_timezone( $datetime, $expe
583583
$this->assertEqualsWithDelta( strtotime( $expected ), strtotime( $found ), 10, $message );
584584
}
585585

586-
public function data_build_mysql_datetime_with_custom_timezone() {
586+
public static function data_build_mysql_datetime_with_custom_timezone() {
587587
return array(
588588
array( '2019-06-04T08:18:24+03:00', '2019-06-04 08:18:24' ),
589589
array( '2019-06-04T05:18:24+00:00', '2019-06-04 08:18:24' ),

‎tests/phpunit/tests/date/wpCheckdate.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function test_wp_checkdate( $month, $day, $year, $source_date, $expected
3131
*
3232
* @return array
3333
*/
34-
public function data_wp_checkdate() {
34+
public static function data_wp_checkdate() {
3535
return array(
3636
'integers' => array( 1, 1, 1, '1-1-1', true ),
3737
'strings' => array( '1', '1', '1', '1-1-1', true ),

‎tests/phpunit/tests/date/wpDate.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function test_should_format_date( $expected, $format ) {
106106
*
107107
* @return array
108108
*/
109-
public function data_should_format_date() {
109+
public static function data_should_format_date() {
110110
return array(
111111
'Swatch Internet Time' => array(
112112
'expected' => '041',

‎tests/phpunit/tests/date/wpTimezone.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function test_should_convert_gmt_offset( $gmt_offset, $tz_name ) {
4444
*
4545
* @return array
4646
*/
47-
public function data_should_convert_gmt_offset() {
47+
public static function data_should_convert_gmt_offset() {
4848
return array(
4949
array( -12, '-12:00' ),
5050
array( -11.5, '-11:30' ),

0 commit comments

Comments
 (0)