Skip to content

Commit f8714f9

Browse files
committed
Extended tests with date constants
1 parent ac41608 commit f8714f9

7 files changed

+123
-57
lines changed

ext/date/tests/DateTimeImmutable_constants.phpt

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@ 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
21+
1822
);
1923

2024
?>
@@ -30,3 +34,6 @@ bool(true)
3034
bool(true)
3135
bool(true)
3236
bool(true)
37+
bool(true)
38+
bool(true)
39+
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 === DateTimeImmutable::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: 9 additions & 3 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

1111
var_dump( $date->format( DateTime::ATOM) ) ;
1212
var_dump( $date->format( DateTime::COOKIE) ) ;
1313
var_dump( $date->format( DateTime::ISO8601) ) ;
14+
var_dump( $date->format( DateTime::ISO8601_EXPANDED) ) ;
1415
var_dump( $date->format( DateTime::RFC822) ) ;
1516
var_dump( $date->format( DateTime::RFC850) ) ;
1617
var_dump( $date->format( DateTime::RFC1036) ) ;
1718
var_dump( $date->format( DateTime::RFC1123) ) ;
18-
var_dump( $date->format( DateTime:: RFC2822) ) ;
19+
var_dump( $date->format( DateTime::RFC7231) ) ;
20+
var_dump( $date->format( DateTime::RFC2822) ) ;
1921
var_dump( $date->format( DateTime::RFC3339) ) ;
22+
var_dump( $date->format( DateTime::RFC3339_EXTENDED) ) ;
2023
var_dump( $date->format( DateTime::RSS) ) ;
2124
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: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ 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,
6+
$formats = array( DATE_ATOM, DATE_COOKIE, DATE_ISO8601, DATE_ISO8601_EXPANDED, DATE_RFC822,
7+
DATE_RFC850, DATE_RFC1036, DATE_RFC1123, DATE_RFC2822, DATE_RFC3339, DATE_RFC3339_EXTENDED,
88
DATE_RSS, DATE_W3C );
99

1010
foreach( $formats as $format )
@@ -54,9 +54,20 @@ object(DateTime)#3 (3) {
5454
string(6) "+02:00"
5555
}
5656

57+
string(13) "X-m-d\TH:i:sP"
58+
string(26) "+2008-07-08T22:14:12+02:00"
59+
object(DateTime)#2 (3) {
60+
["date"]=>
61+
string(26) "2008-07-08 22:14:12.000000"
62+
["timezone_type"]=>
63+
int(1)
64+
["timezone"]=>
65+
string(6) "+02:00"
66+
}
67+
5768
string(16) "D, d M y H:i:s O"
5869
string(29) "Tue, 08 Jul 08 22:14:12 +0200"
59-
object(DateTime)#2 (3) {
70+
object(DateTime)#1 (3) {
6071
["date"]=>
6172
string(26) "2008-07-08 22:14:12.000000"
6273
["timezone_type"]=>
@@ -67,7 +78,7 @@ object(DateTime)#2 (3) {
6778

6879
string(16) "l, d-M-y H:i:s T"
6980
string(36) "Tuesday, 08-Jul-08 22:14:12 GMT+0200"
70-
object(DateTime)#1 (3) {
81+
object(DateTime)#3 (3) {
7182
["date"]=>
7283
string(26) "2008-07-08 22:14:12.000000"
7384
["timezone_type"]=>
@@ -78,7 +89,7 @@ object(DateTime)#1 (3) {
7889

7990
string(16) "D, d M y H:i:s O"
8091
string(29) "Tue, 08 Jul 08 22:14:12 +0200"
81-
object(DateTime)#3 (3) {
92+
object(DateTime)#2 (3) {
8293
["date"]=>
8394
string(26) "2008-07-08 22:14:12.000000"
8495
["timezone_type"]=>
@@ -89,7 +100,7 @@ object(DateTime)#3 (3) {
89100

90101
string(16) "D, d M Y H:i:s O"
91102
string(31) "Tue, 08 Jul 2008 22:14:12 +0200"
92-
object(DateTime)#2 (3) {
103+
object(DateTime)#1 (3) {
93104
["date"]=>
94105
string(26) "2008-07-08 22:14:12.000000"
95106
["timezone_type"]=>
@@ -100,7 +111,7 @@ object(DateTime)#2 (3) {
100111

101112
string(16) "D, d M Y H:i:s O"
102113
string(31) "Tue, 08 Jul 2008 22:14:12 +0200"
103-
object(DateTime)#1 (3) {
114+
object(DateTime)#3 (3) {
104115
["date"]=>
105116
string(26) "2008-07-08 22:14:12.000000"
106117
["timezone_type"]=>
@@ -111,7 +122,18 @@ object(DateTime)#1 (3) {
111122

112123
string(13) "Y-m-d\TH:i:sP"
113124
string(25) "2008-07-08T22:14:12+02:00"
114-
object(DateTime)#3 (3) {
125+
object(DateTime)#2 (3) {
126+
["date"]=>
127+
string(26) "2008-07-08 22:14:12.000000"
128+
["timezone_type"]=>
129+
int(1)
130+
["timezone"]=>
131+
string(6) "+02:00"
132+
}
133+
134+
string(15) "Y-m-d\TH:i:s.vP"
135+
string(29) "2008-07-08T22:14:12.000+02:00"
136+
object(DateTime)#1 (3) {
115137
["date"]=>
116138
string(26) "2008-07-08 22:14:12.000000"
117139
["timezone_type"]=>
@@ -122,7 +144,7 @@ object(DateTime)#3 (3) {
122144

123145
string(16) "D, d M Y H:i:s O"
124146
string(31) "Tue, 08 Jul 2008 22:14:12 +0200"
125-
object(DateTime)#2 (3) {
147+
object(DateTime)#3 (3) {
126148
["date"]=>
127149
string(26) "2008-07-08 22:14:12.000000"
128150
["timezone_type"]=>
@@ -133,7 +155,7 @@ object(DateTime)#2 (3) {
133155

134156
string(13) "Y-m-d\TH:i:sP"
135157
string(25) "2008-07-08T22:14:12+02:00"
136-
object(DateTime)#1 (3) {
158+
object(DateTime)#2 (3) {
137159
["date"]=>
138160
string(26) "2008-07-08 22:14:12.000000"
139161
["timezone_type"]=>

0 commit comments

Comments
 (0)