xref: /PHP-5.6/ext/date/tests/bug20382-2.phpt (revision c0219b32)
1--TEST--
2Bug #20382 [2] (strtotime ("Monday", $date) produces wrong result on DST changeover)
3--FILE--
4<?php
5
6$tests = array(
7	array("Europe/Andorra",     17, 17, 17, 1, 24764, 1970),
8	array("Asia/Dubai",         17, 17, 17, 1, 1, 1970),
9	array("Asia/Kabul",         17, 17, 17, 1, 1, 1970),
10	array("America/Antigua",    17, 17, 17, 1, 1, 1970),
11	array("America/Anguilla",   17, 17, 17, 1, 1, 1970),
12	array("Europe/Tirane",      17, 17, 17, 1, 4849, 1970),
13	array("Asia/Yerevan",       17, 17, 17, 1, 24764, 1970),
14	array("America/Curacao",    17, 17, 17, 1, 1, 1970),
15	array("Africa/Luanda",      17, 17, 17, 1, 1, 1970),
16	array("Antarctica/McMurdo", 17, 17, 17, 1, 24743, 1970),
17	array("Australia/Adelaide", 17, 17, 17, 1, 1, 1971),
18	array("Australia/Darwin",   17, 17, 17, 1, 88, 1971),
19	array("Australia/Perth",    17, 17, 17, 1, 1, 1971),
20	array("America/Aruba",      17, 17, 17, 1, 88, 1971),
21	array("Asia/Baku",          17, 17, 17, 1, 1, 1971),
22	array("Europe/Sarajevo",    17, 17, 17, 1, 1, 1971),
23	array("America/Barbados",   17, 17, 17, 1, 1, 1971),
24	array("Asia/Dacca",         17, 17, 17, 1, 1, 1971),
25	array("Europe/Brussels",    17, 17, 17, 1, 1, 1971),
26	array("Africa/Ouagadougou", 17, 17, 17, 1, 88, 1971),
27	array("Europe/Tirane",      17, 17, 17, 1, 4849, 1970),
28	array("America/Buenos_Aires", 17, 17, 17, 1, 1734, 1970),
29	array("America/Rosario",    17, 17, 17, 1, 1734, 1970),
30	array("Europe/Vienna",      17, 17, 17, 1, 3743, 1970),
31	array("Asia/Baku",          17, 17, 17, 1, 9490, 1970),
32);
33
34foreach ($tests as $test) {
35	date_default_timezone_set($test[0]);
36	print "{$test[0]}\n";
37	array_shift($test);
38	$timestamp = call_user_func_array('mktime', $test);
39
40	print "ts     = ". date("l Y-m-d H:i:s T", $timestamp). "\n";
41	$strtotime_tstamp = strtotime("first monday", $timestamp);
42	print "result = ".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
43	print "wanted = Monday            00:00:00\n\n";
44}
45?>
46--EXPECT--
47Europe/Andorra
48ts     = Monday 2037-10-19 17:17:17 CEST
49result = Monday 2037-10-26 00:00:00 CET
50wanted = Monday            00:00:00
51
52Asia/Dubai
53ts     = Thursday 1970-01-01 17:17:17 GST
54result = Monday 1970-01-05 00:00:00 GST
55wanted = Monday            00:00:00
56
57Asia/Kabul
58ts     = Thursday 1970-01-01 17:17:17 AFT
59result = Monday 1970-01-05 00:00:00 AFT
60wanted = Monday            00:00:00
61
62America/Antigua
63ts     = Thursday 1970-01-01 17:17:17 AST
64result = Monday 1970-01-05 00:00:00 AST
65wanted = Monday            00:00:00
66
67America/Anguilla
68ts     = Thursday 1970-01-01 17:17:17 AST
69result = Monday 1970-01-05 00:00:00 AST
70wanted = Monday            00:00:00
71
72Europe/Tirane
73ts     = Monday 1983-04-11 17:17:17 CET
74result = Monday 1983-04-18 01:00:00 CEST
75wanted = Monday            00:00:00
76
77Asia/Yerevan
78ts     = Monday 2037-10-19 17:17:17 +04
79result = Monday 2037-10-26 00:00:00 +04
80wanted = Monday            00:00:00
81
82America/Curacao
83ts     = Thursday 1970-01-01 17:17:17 AST
84result = Monday 1970-01-05 00:00:00 AST
85wanted = Monday            00:00:00
86
87Africa/Luanda
88ts     = Thursday 1970-01-01 17:17:17 WAT
89result = Monday 1970-01-05 00:00:00 WAT
90wanted = Monday            00:00:00
91
92Antarctica/McMurdo
93ts     = Monday 2037-09-28 17:17:17 NZDT
94result = Monday 2037-10-05 00:00:00 NZDT
95wanted = Monday            00:00:00
96
97Australia/Adelaide
98ts     = Friday 1971-01-01 17:17:17 ACST
99result = Monday 1971-01-04 00:00:00 ACST
100wanted = Monday            00:00:00
101
102Australia/Darwin
103ts     = Monday 1971-03-29 17:17:17 ACST
104result = Monday 1971-04-05 00:00:00 ACST
105wanted = Monday            00:00:00
106
107Australia/Perth
108ts     = Friday 1971-01-01 17:17:17 AWST
109result = Monday 1971-01-04 00:00:00 AWST
110wanted = Monday            00:00:00
111
112America/Aruba
113ts     = Monday 1971-03-29 17:17:17 AST
114result = Monday 1971-04-05 00:00:00 AST
115wanted = Monday            00:00:00
116
117Asia/Baku
118ts     = Friday 1971-01-01 17:17:17 +04
119result = Monday 1971-01-04 00:00:00 +04
120wanted = Monday            00:00:00
121
122Europe/Sarajevo
123ts     = Friday 1971-01-01 17:17:17 CET
124result = Monday 1971-01-04 00:00:00 CET
125wanted = Monday            00:00:00
126
127America/Barbados
128ts     = Friday 1971-01-01 17:17:17 AST
129result = Monday 1971-01-04 00:00:00 AST
130wanted = Monday            00:00:00
131
132Asia/Dacca
133ts     = Friday 1971-01-01 17:17:17 DACT
134result = Monday 1971-01-04 00:00:00 DACT
135wanted = Monday            00:00:00
136
137Europe/Brussels
138ts     = Friday 1971-01-01 17:17:17 CET
139result = Monday 1971-01-04 00:00:00 CET
140wanted = Monday            00:00:00
141
142Africa/Ouagadougou
143ts     = Monday 1971-03-29 17:17:17 GMT
144result = Monday 1971-04-05 00:00:00 GMT
145wanted = Monday            00:00:00
146
147Europe/Tirane
148ts     = Monday 1983-04-11 17:17:17 CET
149result = Monday 1983-04-18 01:00:00 CEST
150wanted = Monday            00:00:00
151
152America/Buenos_Aires
153ts     = Monday 1974-09-30 17:17:17 ART
154result = Monday 1974-10-07 00:00:00 ART
155wanted = Monday            00:00:00
156
157America/Rosario
158ts     = Monday 1974-09-30 17:17:17 ART
159result = Monday 1974-10-07 00:00:00 ART
160wanted = Monday            00:00:00
161
162Europe/Vienna
163ts     = Monday 1980-03-31 17:17:17 CET
164result = Monday 1980-04-07 00:00:00 CEST
165wanted = Monday            00:00:00
166
167Asia/Baku
168ts     = Monday 1995-12-25 17:17:17 +04
169result = Monday 1996-01-01 00:00:00 +04
170wanted = Monday            00:00:00
171