Skip to content

Commit b67c232

Browse files
committed
Merged pull request #11241
2 parents e9e6eb7 + 0dfac0e commit b67c232

7 files changed

+135
-68
lines changed

ext/date/tests/DateTimeImmutable_constants.phpt

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,20 @@ DateTimeImmutable constants
44
<?php
55

66
var_dump(
7-
DATE_ATOM === DateTimeImmutable::ATOM,
8-
DATE_COOKIE === DateTimeImmutable::COOKIE,
9-
DATE_ISO8601 === DateTimeImmutable::ISO8601,
10-
DATE_RFC822 === DateTimeImmutable::RFC822,
11-
DATE_RFC850 === DateTimeImmutable::RFC850,
12-
DATE_RFC1036 === DateTimeImmutable::RFC1036,
13-
DATE_RFC1123 === DateTimeImmutable::RFC1123,
14-
DATE_RFC2822 === DateTimeImmutable::RFC2822,
15-
DATE_RFC3339 === DateTimeImmutable::RFC3339,
16-
DATE_RSS === DateTimeImmutable::RSS,
17-
DATE_W3C === DateTimeImmutable::W3C
7+
DATE_ATOM === DateTimeImmutable::ATOM,
8+
DATE_COOKIE === DateTimeImmutable::COOKIE,
9+
DATE_ISO8601 === DateTimeImmutable::ISO8601,
10+
DATE_ISO8601_EXPANDED === DateTimeImmutable::ISO8601_EXPANDED,
11+
DATE_RFC822 === DateTimeImmutable::RFC822,
12+
DATE_RFC850 === DateTimeImmutable::RFC850,
13+
DATE_RFC1036 === DateTimeImmutable::RFC1036,
14+
DATE_RFC1123 === DateTimeImmutable::RFC1123,
15+
DATE_RFC7231 === DateTimeImmutable::RFC7231,
16+
DATE_RFC2822 === DateTimeImmutable::RFC2822,
17+
DATE_RFC3339 === DateTimeImmutable::RFC3339,
18+
DATE_RFC3339_EXTENDED === DateTimeImmutable::RFC3339_EXTENDED,
19+
DATE_RSS === DateTimeImmutable::RSS,
20+
DATE_W3C === DateTimeImmutable::W3C
1821
);
1922

2023
?>
@@ -30,3 +33,6 @@ bool(true)
3033
bool(true)
3134
bool(true)
3235
bool(true)
36+
bool(true)
37+
bool(true)
38+
bool(true)

ext/date/tests/DateTimeInterface_constants.phpt

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,20 @@ DateTimeInterface constants
44
<?php
55

66
var_dump(
7-
DATE_ATOM === DateTimeInterface::ATOM,
8-
DATE_COOKIE === DateTimeInterface::COOKIE,
9-
DATE_ISO8601 === DateTimeInterface::ISO8601,
10-
DATE_RFC822 === DateTimeInterface::RFC822,
11-
DATE_RFC850 === DateTimeInterface::RFC850,
12-
DATE_RFC1036 === DateTimeInterface::RFC1036,
13-
DATE_RFC1123 === DateTimeInterface::RFC1123,
14-
DATE_RFC2822 === DateTimeInterface::RFC2822,
15-
DATE_RFC3339 === DateTimeInterface::RFC3339,
16-
DATE_RSS === DateTimeInterface::RSS,
17-
DATE_W3C === DateTimeInterface::W3C
7+
DATE_ATOM === DateTimeInterface::ATOM,
8+
DATE_COOKIE === DateTimeInterface::COOKIE,
9+
DATE_ISO8601 === DateTimeInterface::ISO8601,
10+
DATE_ISO8601_EXPANDED === DateTimeInterface::ISO8601_EXPANDED,
11+
DATE_RFC822 === DateTimeInterface::RFC822,
12+
DATE_RFC850 === DateTimeInterface::RFC850,
13+
DATE_RFC1036 === DateTimeInterface::RFC1036,
14+
DATE_RFC1123 === DateTimeInterface::RFC1123,
15+
DATE_RFC7231 === DateTimeInterface::RFC7231,
16+
DATE_RFC2822 === DateTimeInterface::RFC2822,
17+
DATE_RFC3339 === DateTimeInterface::RFC3339,
18+
DATE_RFC3339_EXTENDED === DateTimeInterface::RFC3339_EXTENDED,
19+
DATE_RSS === DateTimeInterface::RSS,
20+
DATE_W3C === DateTimeInterface::W3C
1821
);
1922

2023
?>
@@ -30,3 +33,6 @@ bool(true)
3033
bool(true)
3134
bool(true)
3235
bool(true)
36+
bool(true)
37+
bool(true)
38+
bool(true)

ext/date/tests/DateTime_constants.phpt

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,20 @@ DateTime constants
44
<?php
55

66
var_dump(
7-
DATE_ATOM === DateTime::ATOM,
8-
DATE_COOKIE === DateTime::COOKIE,
9-
DATE_ISO8601 === DateTime::ISO8601,
10-
DATE_RFC822 === DateTime::RFC822,
11-
DATE_RFC850 === DateTime::RFC850,
12-
DATE_RFC1036 === DateTime::RFC1036,
13-
DATE_RFC1123 === DateTime::RFC1123,
14-
DATE_RFC2822 === DateTime::RFC2822,
15-
DATE_RFC3339 === DateTime::RFC3339,
16-
DATE_RSS === DateTime::RSS,
17-
DATE_W3C === DateTime::W3C
7+
DATE_ATOM === DateTime::ATOM,
8+
DATE_COOKIE === DateTime::COOKIE,
9+
DATE_ISO8601 === DateTime::ISO8601,
10+
DATE_ISO8601_EXPANDED === DateTime::ISO8601_EXPANDED,
11+
DATE_RFC822 === DateTime::RFC822,
12+
DATE_RFC850 === DateTime::RFC850,
13+
DATE_RFC1036 === DateTime::RFC1036,
14+
DATE_RFC1123 === DateTime::RFC1123,
15+
DATE_RFC7231 === DateTime::RFC7231,
16+
DATE_RFC2822 === DateTime::RFC2822,
17+
DATE_RFC3339 === DateTime::RFC3339,
18+
DATE_RFC3339_EXTENDED === DateTime::RFC3339_EXTENDED,
19+
DATE_RSS === DateTime::RSS,
20+
DATE_W3C === DateTime::W3C
1821
);
1922

2023
?>
@@ -30,3 +33,6 @@ bool(true)
3033
bool(true)
3134
bool(true)
3235
bool(true)
36+
bool(true)
37+
bool(true)
38+
bool(true)

ext/date/tests/DateTime_format_basic2.phpt

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,38 @@ Test date_format() function : basic functionality
55
//Set the default time zone
66
date_default_timezone_set("Europe/London");
77

8-
echo "*** Testing date_format() : basic functionality - formatting coinstants ***\n";
8+
echo "*** Testing date_format() : basic functionality - formatting constants ***\n";
99
$date = new DateTime("2005-07-14 22:30:41");
1010

11-
var_dump( $date->format( DateTime::ATOM) ) ;
12-
var_dump( $date->format( DateTime::COOKIE) ) ;
13-
var_dump( $date->format( DateTime::ISO8601) ) ;
14-
var_dump( $date->format( DateTime::RFC822) ) ;
15-
var_dump( $date->format( DateTime::RFC850) ) ;
16-
var_dump( $date->format( DateTime::RFC1036) ) ;
17-
var_dump( $date->format( DateTime::RFC1123) ) ;
18-
var_dump( $date->format( DateTime:: RFC2822) ) ;
19-
var_dump( $date->format( DateTime::RFC3339) ) ;
20-
var_dump( $date->format( DateTime::RSS) ) ;
21-
var_dump( $date->format( DateTime::W3C) ) ;
11+
var_dump($date->format(DateTime::ATOM));
12+
var_dump($date->format(DateTime::COOKIE));
13+
var_dump($date->format(DateTime::ISO8601));
14+
var_dump($date->format(DateTime::ISO8601_EXPANDED));
15+
var_dump($date->format(DateTime::RFC822));
16+
var_dump($date->format(DateTime::RFC850));
17+
var_dump($date->format(DateTime::RFC1036));
18+
var_dump($date->format(DateTime::RFC1123));
19+
var_dump($date->format(DateTime::RFC7231));
20+
var_dump($date->format(DateTime::RFC2822));
21+
var_dump($date->format(DateTime::RFC3339));
22+
var_dump($date->format(DateTime::RFC3339_EXTENDED));
23+
var_dump($date->format(DateTime::RSS));
24+
var_dump($date->format(DateTime::W3C));
2225

2326
?>
2427
--EXPECT--
25-
*** Testing date_format() : basic functionality - formatting coinstants ***
28+
*** Testing date_format() : basic functionality - formatting constants ***
2629
string(25) "2005-07-14T22:30:41+01:00"
2730
string(34) "Thursday, 14-Jul-2005 22:30:41 BST"
2831
string(24) "2005-07-14T22:30:41+0100"
32+
string(26) "+2005-07-14T22:30:41+01:00"
2933
string(29) "Thu, 14 Jul 05 22:30:41 +0100"
3034
string(32) "Thursday, 14-Jul-05 22:30:41 BST"
3135
string(29) "Thu, 14 Jul 05 22:30:41 +0100"
3236
string(31) "Thu, 14 Jul 2005 22:30:41 +0100"
37+
string(29) "Thu, 14 Jul 2005 22:30:41 GMT"
3338
string(31) "Thu, 14 Jul 2005 22:30:41 +0100"
3439
string(25) "2005-07-14T22:30:41+01:00"
40+
string(29) "2005-07-14T22:30:41.000+01:00"
3541
string(31) "Thu, 14 Jul 2005 22:30:41 +0100"
3642
string(25) "2005-07-14T22:30:41+01:00"

ext/date/tests/date_constants.phpt

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ Date constants
77
DATE_ATOM,
88
DATE_COOKIE,
99
DATE_ISO8601,
10+
DATE_ISO8601_EXPANDED,
1011
DATE_RFC822,
1112
DATE_RFC850,
1213
DATE_RFC1036,
1314
DATE_RFC1123,
15+
DATE_RFC7231,
1416
DATE_RFC2822,
1517
DATE_RFC3339,
18+
DATE_RFC3339_EXTENDED,
1619
DATE_RSS,
1720
DATE_W3C
1821
);
@@ -25,17 +28,20 @@ Date constants
2528
print "\n";
2629

2730
var_dump(
28-
DATE_ATOM == DateTime::ATOM,
29-
DATE_COOKIE == DateTime::COOKIE,
30-
DATE_ISO8601 == DateTime::ISO8601,
31-
DATE_RFC822 == DateTime::RFC822,
32-
DATE_RFC850 == DateTime::RFC850,
33-
DATE_RFC1036 == DateTime::RFC1036,
34-
DATE_RFC1123 == DateTime::RFC1123,
35-
DATE_RFC2822 == DateTime::RFC2822,
36-
DATE_RFC3339 == DateTime::RFC3339,
37-
DATE_RSS == DateTime::RSS,
38-
DATE_W3C == DateTime::W3C
31+
DATE_ATOM == DateTime::ATOM,
32+
DATE_COOKIE == DateTime::COOKIE,
33+
DATE_ISO8601 == DateTime::ISO8601,
34+
DATE_ISO8601_EXPANDED == DateTime::ISO8601_EXPANDED,
35+
DATE_RFC822 == DateTime::RFC822,
36+
DATE_RFC850 == DateTime::RFC850,
37+
DATE_RFC1036 == DateTime::RFC1036,
38+
DATE_RFC1123 == DateTime::RFC1123,
39+
DATE_RFC2822 == DateTime::RFC2822,
40+
DATE_RFC7231 == DateTime::RFC7231,
41+
DATE_RFC3339 == DateTime::RFC3339,
42+
DATE_RFC3339_EXTENDED == DateTime::RFC3339_EXTENDED,
43+
DATE_RSS == DateTime::RSS,
44+
DATE_W3C == DateTime::W3C
3945
);
4046
?>
4147
--EXPECT--
@@ -45,6 +51,8 @@ string(35) "Saturday, 01-Jul-2006 14:27:30 CEST"
4551
string(34) "Tuesday, 30-May-2006 14:32:13 CEST"
4652
string(24) "2006-07-01T14:27:30+0200"
4753
string(24) "2006-05-30T14:32:13+0200"
54+
string(26) "+2006-07-01T14:27:30+02:00"
55+
string(26) "+2006-05-30T14:32:13+02:00"
4856
string(29) "Sat, 01 Jul 06 14:27:30 +0200"
4957
string(29) "Tue, 30 May 06 14:32:13 +0200"
5058
string(33) "Saturday, 01-Jul-06 14:27:30 CEST"
@@ -53,10 +61,14 @@ string(29) "Sat, 01 Jul 06 14:27:30 +0200"
5361
string(29) "Tue, 30 May 06 14:32:13 +0200"
5462
string(31) "Sat, 01 Jul 2006 14:27:30 +0200"
5563
string(31) "Tue, 30 May 2006 14:32:13 +0200"
64+
string(29) "Sat, 01 Jul 2006 14:27:30 GMT"
65+
string(29) "Tue, 30 May 2006 14:32:13 GMT"
5666
string(31) "Sat, 01 Jul 2006 14:27:30 +0200"
5767
string(31) "Tue, 30 May 2006 14:32:13 +0200"
5868
string(25) "2006-07-01T14:27:30+02:00"
5969
string(25) "2006-05-30T14:32:13+02:00"
70+
string(29) "2006-07-01T14:27:30.000+02:00"
71+
string(29) "2006-05-30T14:32:13.000+02:00"
6072
string(31) "Sat, 01 Jul 2006 14:27:30 +0200"
6173
string(31) "Tue, 30 May 2006 14:32:13 +0200"
6274
string(25) "2006-07-01T14:27:30+02:00"
@@ -73,3 +85,6 @@ bool(true)
7385
bool(true)
7486
bool(true)
7587
bool(true)
88+
bool(true)
89+
bool(true)
90+
bool(true)

ext/date/tests/strtotime2.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ $constants = array(
1010
'DATE_ATOM',
1111
'DATE_COOKIE',
1212
'DATE_ISO8601',
13+
'DATE_ISO8601_EXPANDED',
1314
'DATE_RFC822',
1415
'DATE_RFC850',
1516
'DATE_RFC1036',
1617
'DATE_RFC1123',
1718
'DATE_RFC2822',
1819
'DATE_RFC3339',
20+
'DATE_RFC3339_EXTENDED',
1921
'DATE_RSS',
2022
'DATE_W3C'
2123
);
@@ -30,11 +32,13 @@ foreach ($constants as $const) {
3032
DATE_ATOM: OK
3133
DATE_COOKIE: OK
3234
DATE_ISO8601: OK
35+
DATE_ISO8601_EXPANDED: OK
3336
DATE_RFC822: OK
3437
DATE_RFC850: OK
3538
DATE_RFC1036: OK
3639
DATE_RFC1123: OK
3740
DATE_RFC2822: OK
3841
DATE_RFC3339: OK
42+
DATE_RFC3339_EXTENDED: OK
3943
DATE_RSS: OK
4044
DATE_W3C: OK

ext/date/tests/test-parse-from-format.phpt

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ date_create_from_format() and date_parse_from_format().
33
--FILE--
44
<?php
55
date_default_timezone_set('Europe/Oslo');
6-
$formats = array( DATE_ATOM, DATE_COOKIE, DATE_ISO8601, DATE_RFC822,
7-
DATE_RFC850, DATE_RFC1036, DATE_RFC1123, DATE_RFC2822, DATE_RFC3339,
8-
DATE_RSS, DATE_W3C );
6+
$formats = [
7+
DATE_ATOM, DATE_COOKIE, DATE_ISO8601, DATE_ISO8601_EXPANDED, DATE_RFC822,
8+
DATE_RFC850, DATE_RFC1036, DATE_RFC1123, DATE_RFC2822, DATE_RFC3339,
9+
DATE_RFC3339_EXTENDED, DATE_RSS, DATE_W3C
10+
];
911

1012
foreach( $formats as $format )
1113
{
@@ -54,9 +56,20 @@ object(DateTime)#3 (3) {
5456
string(6) "+02:00"
5557
}
5658

59+
string(13) "X-m-d\TH:i:sP"
60+
string(26) "+2008-07-08T22:14:12+02:00"
61+
object(DateTime)#2 (3) {
62+
["date"]=>
63+
string(26) "2008-07-08 22:14:12.000000"
64+
["timezone_type"]=>
65+
int(1)
66+
["timezone"]=>
67+
string(6) "+02:00"
68+
}
69+
5770
string(16) "D, d M y H:i:s O"
5871
string(29) "Tue, 08 Jul 08 22:14:12 +0200"
59-
object(DateTime)#2 (3) {
72+
object(DateTime)#1 (3) {
6073
["date"]=>
6174
string(26) "2008-07-08 22:14:12.000000"
6275
["timezone_type"]=>
@@ -67,7 +80,7 @@ object(DateTime)#2 (3) {
6780

6881
string(16) "l, d-M-y H:i:s T"
6982
string(36) "Tuesday, 08-Jul-08 22:14:12 GMT+0200"
70-
object(DateTime)#1 (3) {
83+
object(DateTime)#3 (3) {
7184
["date"]=>
7285
string(26) "2008-07-08 22:14:12.000000"
7386
["timezone_type"]=>
@@ -78,7 +91,7 @@ object(DateTime)#1 (3) {
7891

7992
string(16) "D, d M y H:i:s O"
8093
string(29) "Tue, 08 Jul 08 22:14:12 +0200"
81-
object(DateTime)#3 (3) {
94+
object(DateTime)#2 (3) {
8295
["date"]=>
8396
string(26) "2008-07-08 22:14:12.000000"
8497
["timezone_type"]=>
@@ -89,7 +102,7 @@ object(DateTime)#3 (3) {
89102

90103
string(16) "D, d M Y H:i:s O"
91104
string(31) "Tue, 08 Jul 2008 22:14:12 +0200"
92-
object(DateTime)#2 (3) {
105+
object(DateTime)#1 (3) {
93106
["date"]=>
94107
string(26) "2008-07-08 22:14:12.000000"
95108
["timezone_type"]=>
@@ -100,7 +113,7 @@ object(DateTime)#2 (3) {
100113

101114
string(16) "D, d M Y H:i:s O"
102115
string(31) "Tue, 08 Jul 2008 22:14:12 +0200"
103-
object(DateTime)#1 (3) {
116+
object(DateTime)#3 (3) {
104117
["date"]=>
105118
string(26) "2008-07-08 22:14:12.000000"
106119
["timezone_type"]=>
@@ -111,7 +124,18 @@ object(DateTime)#1 (3) {
111124

112125
string(13) "Y-m-d\TH:i:sP"
113126
string(25) "2008-07-08T22:14:12+02:00"
114-
object(DateTime)#3 (3) {
127+
object(DateTime)#2 (3) {
128+
["date"]=>
129+
string(26) "2008-07-08 22:14:12.000000"
130+
["timezone_type"]=>
131+
int(1)
132+
["timezone"]=>
133+
string(6) "+02:00"
134+
}
135+
136+
string(15) "Y-m-d\TH:i:s.vP"
137+
string(29) "2008-07-08T22:14:12.000+02:00"
138+
object(DateTime)#1 (3) {
115139
["date"]=>
116140
string(26) "2008-07-08 22:14:12.000000"
117141
["timezone_type"]=>
@@ -122,7 +146,7 @@ object(DateTime)#3 (3) {
122146

123147
string(16) "D, d M Y H:i:s O"
124148
string(31) "Tue, 08 Jul 2008 22:14:12 +0200"
125-
object(DateTime)#2 (3) {
149+
object(DateTime)#3 (3) {
126150
["date"]=>
127151
string(26) "2008-07-08 22:14:12.000000"
128152
["timezone_type"]=>
@@ -133,7 +157,7 @@ object(DateTime)#2 (3) {
133157

134158
string(13) "Y-m-d\TH:i:sP"
135159
string(25) "2008-07-08T22:14:12+02:00"
136-
object(DateTime)#1 (3) {
160+
object(DateTime)#2 (3) {
137161
["date"]=>
138162
string(26) "2008-07-08 22:14:12.000000"
139163
["timezone_type"]=>

0 commit comments

Comments
 (0)