xref: /PHP-5.5/ext/date/tests/bug33414-2.phpt (revision e753493c)
1--TEST--
2Bug #33414 [2] (Comprehensive list of incorrect days returned after strotime() / date() tests)
3--FILE--
4<?php
5print "TZ=Pacific/Rarotonga - wrong day.\n";
6date_default_timezone_set("Pacific/Rarotonga");
7$tStamp = mktime (17, 17, 17, 1, 1, 1970);
8print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
9$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
10print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
11print "wanted=Tuesday            00:00:00\n\n";
12
13print "TZ=Atlantic/South_Georgia - wrong day.\n";
14date_default_timezone_set("Atlantic/South_Georgia");
15$tStamp = mktime (17, 17, 17, 1, 1, 1970);
16print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
17$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
18print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
19print "wanted=Tuesday            00:00:00\n\n";
20
21print "TZ=America/Port-au-Prince - wrong day.\n";
22date_default_timezone_set("America/Port-au-Prince");
23$tStamp = mktime (17, 17, 17, 1, 12871, 1970);
24print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
25$strtotime_tstamp = strtotime("next Monday", $tStamp);
26print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
27print "wanted=Monday            00:00:00\n\n";
28
29print "TZ=Pacific/Enderbury - wrong day, off by 2 days.\n";
30date_default_timezone_set("Pacific/Enderbury");
31$tStamp = mktime (17, 17, 17, 1, 1, 1970);
32print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
33$strtotime_tstamp = strtotime("next Monday", $tStamp);
34print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
35print "wanted=Monday            00:00:00\n\n";
36
37print "TZ=Pacific/Kiritimati - wrong day, off by 2 days.\n";
38date_default_timezone_set("Pacific/Kiritimati");
39$tStamp = mktime (17, 17, 17, 1, 1, 1970);
40print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
41$strtotime_tstamp = strtotime("next Monday", $tStamp);
42print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
43print "wanted=Monday            00:00:00\n\n";
44
45print "TZ=America/Managua - wrong day.\n";
46date_default_timezone_set("America/Managua");
47$tStamp = mktime (17, 17, 17, 1, 12879, 1970);
48print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
49$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
50print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
51print "wanted=Tuesday            00:00:00\n\n";
52
53print "TZ=Pacific/Pitcairn - wrong day.\n";
54date_default_timezone_set("Pacific/Pitcairn");
55$tStamp = mktime (17, 17, 17, 1, 1, 1970);
56print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
57$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
58print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
59print "wanted=Wednesday            00:00:00\n\n";
60
61print "TZ=Pacific/Fakaofo - wrong day.\n";
62date_default_timezone_set("Pacific/Fakaofo");
63$tStamp = mktime (17, 17, 17, 1, 1, 1970);
64print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
65$strtotime_tstamp = strtotime("next Saturday", $tStamp);
66print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
67print "wanted=Saturday            00:00:00\n\n";
68
69print "TZ=Pacific/Johnston - wrong day.\n";
70date_default_timezone_set("Pacific/Johnston");
71$tStamp = mktime (17, 17, 17, 1, 1, 1970);
72print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
73$strtotime_tstamp = strtotime("next Friday", $tStamp);
74print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
75print "wanted=Friday            00:00:00\n\n";
76?>
77--EXPECT--
78TZ=Pacific/Rarotonga - wrong day.
79tStamp=Thursday 1970-01-01 17:17:17 CKT 0
80result=Tuesday 1970-01-06 00:00:00 CKT 0
81wanted=Tuesday            00:00:00
82
83TZ=Atlantic/South_Georgia - wrong day.
84tStamp=Thursday 1970-01-01 17:17:17 GST 0
85result=Tuesday 1970-01-06 00:00:00 GST 0
86wanted=Tuesday            00:00:00
87
88TZ=America/Port-au-Prince - wrong day.
89tStamp=Monday 2005-03-28 17:17:17 EST 0
90result=Monday 2005-04-04 00:00:00 EDT 1
91wanted=Monday            00:00:00
92
93TZ=Pacific/Enderbury - wrong day, off by 2 days.
94tStamp=Thursday 1970-01-01 17:17:17 PHOT 0
95result=Monday 1970-01-05 00:00:00 PHOT 0
96wanted=Monday            00:00:00
97
98TZ=Pacific/Kiritimati - wrong day, off by 2 days.
99tStamp=Thursday 1970-01-01 17:17:17 LINT 0
100result=Monday 1970-01-05 00:00:00 LINT 0
101wanted=Monday            00:00:00
102
103TZ=America/Managua - wrong day.
104tStamp=Tuesday 2005-04-05 17:17:17 CST 0
105result=Tuesday 2005-04-12 00:00:00 CDT 1
106wanted=Tuesday            00:00:00
107
108TZ=Pacific/Pitcairn - wrong day.
109tStamp=Thursday 1970-01-01 17:17:17 PNT 0
110result=Wednesday 1970-01-07 00:00:00 PNT 0
111wanted=Wednesday            00:00:00
112
113TZ=Pacific/Fakaofo - wrong day.
114tStamp=Thursday 1970-01-01 17:17:17 TKT 0
115result=Saturday 1970-01-03 00:00:00 TKT 0
116wanted=Saturday            00:00:00
117
118TZ=Pacific/Johnston - wrong day.
119tStamp=Thursday 1970-01-01 17:17:17 HST 0
120result=Friday 1970-01-02 00:00:00 HST 0
121wanted=Friday            00:00:00
122