Skip to content

Commit 8faf812

Browse files
committed
Fix return type and data format of data provider
1 parent e06836c commit 8faf812

File tree

1 file changed

+86
-86
lines changed

1 file changed

+86
-86
lines changed

tests/phpunit/tests/post.php

Lines changed: 86 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -848,99 +848,99 @@ public function test_wp_insert_post_handle_malformed_post_date( $input, $expecte
848848
/**
849849
* Data provider for test_wp_insert_post_handle_malformed_post_date().
850850
*
851-
* @return array<string, array{ date: string, expected: bool }>
851+
* @return array<array{ date: string, expected: bool }>
852852
*/
853-
public static function data_wp_insert_post_handle_malformed_post_date() {
853+
public static function data_wp_insert_post_handle_malformed_post_date(): array {
854854
return array(
855855
array(
856-
'2012-01-01',
857-
true,
856+
'date' => '2012-01-01',
857+
'expected' => true,
858858
),
859859
// 24-hour time format.
860860
array(
861-
'2012-01-01 13:00:00',
862-
true,
861+
'date' => '2012-01-01 13:00:00',
862+
'expected' => true,
863863
),
864864
// ISO8601 date with timezone.
865865
array(
866-
'2016-01-16T00:00:00Z',
867-
true,
866+
'date' => '2016-01-16T00:00:00Z',
867+
'expected' => true,
868868
),
869869
// ISO8601 date with timezone offset.
870870
array(
871-
'2016-01-16T00:00:00+0100',
872-
true,
871+
'date' => '2016-01-16T00:00:00+0100',
872+
'expected' => true,
873873
),
874874
// RFC3339 Format.
875875
array(
876-
'1970-01-01T01:00:00+01:00',
877-
true,
876+
'date' => '1970-01-01T01:00:00+01:00',
877+
'expected' => true,
878878
),
879879
// RSS Format
880880
array(
881-
'1970-01-01T01:00:00+0100',
882-
true,
881+
'date' => '1970-01-01T01:00:00+0100',
882+
'expected' => true,
883883
),
884884
// Leap year.
885885
array(
886-
'2012-02-29',
887-
true,
886+
'date' => '2012-02-29',
887+
'expected' => true,
888888
),
889889
// Strange formats.
890890
array(
891-
'2012-01-01 0',
892-
true,
891+
'date' => '2012-01-01 0',
892+
'expected' => true,
893893
),
894894
array(
895-
'2012-01-01 25:00:00',
896-
true,
895+
'date' => '2012-01-01 25:00:00',
896+
'expected' => true,
897897
),
898898
array(
899-
'2012-01-01 00:60:00',
900-
true,
899+
'date' => '2012-01-01 00:60:00',
900+
'expected' => true,
901901
),
902902
// Dates without leading zeros (valid but malformed format).
903903
array(
904-
'2012-08-1',
905-
true,
904+
'date' => '2012-08-1',
905+
'expected' => true,
906906
),
907907
array(
908-
'2012-1-08 00:00:00',
909-
true,
908+
'date' => '2012-1-08 00:00:00',
909+
'expected' => true,
910910
),
911911
array(
912-
'2012-01-8 00:00:00',
913-
true,
912+
'date' => '2012-01-8 00:00:00',
913+
'expected' => true,
914914
),
915915
// Failures.
916916
array(
917-
'2012-08-0z',
918-
false,
917+
'date' => '2012-08-0z',
918+
'expected' => false,
919919
),
920920
array(
921-
'201-01-08 00:00:00',
922-
false,
921+
'date' => '201-01-08 00:00:00',
922+
'expected' => false,
923923
),
924924
array(
925-
'201-01-08 00:60:00',
926-
false,
925+
'date' => '201-01-08 00:60:00',
926+
'expected' => false,
927927
),
928928
array(
929-
'201a-01-08 00:00:00',
930-
false,
929+
'date' => '201a-01-08 00:00:00',
930+
'expected' => false,
931931
),
932932
array(
933-
'2012-31-08 00:00:00',
934-
false,
933+
'date' => '2012-31-08 00:00:00',
934+
'expected' => false,
935935
),
936936
array(
937-
'2012-01-48 00:00:00',
938-
false,
937+
'date' => '2012-01-48 00:00:00',
938+
'expected' => false,
939939
),
940940
// Not a leap year.
941941
array(
942-
'2011-02-29',
943-
false,
942+
'date' => '2011-02-29',
943+
'expected' => false,
944944
),
945945
);
946946
}
@@ -969,100 +969,100 @@ public function test_wp_resolve_post_date_regex( $date, $expected ) {
969969
/**
970970
* Data provider for test_wp_resolve_post_date_regex().
971971
*
972-
* @return array<string, array{ date: string, expected: string|false }>
972+
* @return array<array{ date: string, expected: string|false }>
973973
*/
974-
public static function data_wp_resolve_post_date_regex() {
974+
public static function data_wp_resolve_post_date_regex(): array {
975975
return array(
976976
array(
977-
'2012-01-01',
978-
'2012-01-01',
977+
'date' => '2012-01-01',
978+
'expected' => '2012-01-01',
979979
),
980980
array(
981-
'2012-01-01 00:00:00',
982-
'2012-01-01 00:00:00',
981+
'date' => '2012-01-01 00:00:00',
982+
'expected' => '2012-01-01 00:00:00',
983983
),
984984
// ISO8601 date with timezone.
985985
array(
986-
'2016-01-16T00:00:00Z',
987-
'2016-01-16T00:00:00Z',
986+
'date' => '2016-01-16T00:00:00Z',
987+
'expected' => '2016-01-16T00:00:00Z',
988988
),
989989
// ISO8601 date with timezone offset.
990990
array(
991-
'2016-01-16T00:00:00+0100',
992-
'2016-01-16T00:00:00+0100',
991+
'date' => '2016-01-16T00:00:00+0100',
992+
'expected' => '2016-01-16T00:00:00+0100',
993993
),
994994
// RFC3339 Format.
995995
array(
996-
'1970-01-01T01:00:00+01:00',
997-
'1970-01-01T01:00:00+01:00',
996+
'date' => '1970-01-01T01:00:00+01:00',
997+
'expected' => '1970-01-01T01:00:00+01:00',
998998
),
999999
// RSS Format
10001000
array(
1001-
'1970-01-01T01:00:00+0100',
1002-
'1970-01-01T01:00:00+0100',
1001+
'date' => '1970-01-01T01:00:00+0100',
1002+
'expected' => '1970-01-01T01:00:00+0100',
10031003
),
10041004
// 24-hour time format.
10051005
array(
1006-
'2012-01-01 13:00:00',
1007-
'2012-01-01 13:00:00',
1006+
'date' => '2012-01-01 13:00:00',
1007+
'expected' => '2012-01-01 13:00:00',
10081008
),
10091009
array(
1010-
'2016-01-16T00:0',
1011-
'2016-01-16T00:0',
1010+
'date' => '2016-01-16T00:0',
1011+
'expected' => '2016-01-16T00:0',
10121012
),
10131013
array(
1014-
'2012-01-01 0',
1015-
'2012-01-01 0',
1014+
'date' => '2012-01-01 0',
1015+
'expected' => '2012-01-01 0',
10161016
),
10171017
array(
1018-
'2012-01-01 00:00',
1019-
'2012-01-01 00:00',
1018+
'date' => '2012-01-01 00:00',
1019+
'expected' => '2012-01-01 00:00',
10201020
),
10211021
array(
1022-
'2012-01-01 25:00:00',
1023-
'2012-01-01 25:00:00',
1022+
'date' => '2012-01-01 25:00:00',
1023+
'expected' => '2012-01-01 25:00:00',
10241024
),
10251025
array(
1026-
'2012-01-01 00:60:00',
1027-
'2012-01-01 00:60:00',
1026+
'date' => '2012-01-01 00:60:00',
1027+
'expected' => '2012-01-01 00:60:00',
10281028
),
10291029
array(
1030-
'2012-01-01 00:00:60',
1031-
'2012-01-01 00:00:60',
1030+
'date' => '2012-01-01 00:00:60',
1031+
'expected' => '2012-01-01 00:00:60',
10321032
),
10331033
// Dates without leading zeros (valid but malformed format).
10341034
array(
1035-
'2012-1-08',
1036-
'2012-1-08',
1035+
'date' => '2012-1-08',
1036+
'expected' => '2012-1-08',
10371037
),
10381038
array(
1039-
'2012-01-8',
1040-
'2012-01-8',
1039+
'date' => '2012-01-8',
1040+
'expected' => '2012-01-8',
10411041
),
10421042
array(
1043-
'201-01-08',
1044-
false,
1043+
'date' => '201-01-08',
1044+
'expected' => false,
10451045
),
10461046
array(
1047-
'201a-01-08',
1048-
false,
1047+
'date' => '201a-01-08',
1048+
'expected' => false,
10491049
),
10501050
array(
1051-
'2012-31-08',
1052-
false,
1051+
'date' => '2012-31-08',
1052+
'expected' => false,
10531053
),
10541054
array(
1055-
'2012-01-48 00:00:00',
1056-
false,
1055+
'date' => '2012-01-48 00:00:00',
1056+
'expected' => false,
10571057
),
10581058
// Leap year.
10591059
array(
1060-
'2012-02-29',
1061-
'2012-02-29',
1060+
'date' => '2012-02-29',
1061+
'expected' => '2012-02-29',
10621062
),
10631063
array(
1064-
'2011-02-29',
1065-
false,
1064+
'date' => '2011-02-29',
1065+
'expected' => false,
10661066
),
10671067
);
10681068
}

0 commit comments

Comments
 (0)