@@ -60,6 +60,8 @@ public function testInvalidInputOption()
60
60
public function testSubmitFromSingleTextDateTimeWithDefaultFormat ()
61
61
{
62
62
$ form = $ this ->factory ->create ('date ' , null , array (
63
+ 'model_timezone ' => 'UTC ' ,
64
+ 'view_timezone ' => 'UTC ' ,
63
65
'widget ' => 'single_text ' ,
64
66
'input ' => 'datetime ' ,
65
67
));
@@ -74,6 +76,8 @@ public function testSubmitFromSingleTextDateTime()
74
76
{
75
77
$ form = $ this ->factory ->create ('date ' , null , array (
76
78
'format ' => \IntlDateFormatter::MEDIUM ,
79
+ 'model_timezone ' => 'UTC ' ,
80
+ 'view_timezone ' => 'UTC ' ,
77
81
'widget ' => 'single_text ' ,
78
82
'input ' => 'datetime ' ,
79
83
));
@@ -88,6 +92,8 @@ public function testSubmitFromSingleTextString()
88
92
{
89
93
$ form = $ this ->factory ->create ('date ' , null , array (
90
94
'format ' => \IntlDateFormatter::MEDIUM ,
95
+ 'model_timezone ' => 'UTC ' ,
96
+ 'view_timezone ' => 'UTC ' ,
91
97
'widget ' => 'single_text ' ,
92
98
'input ' => 'string ' ,
93
99
));
@@ -102,6 +108,8 @@ public function testSubmitFromSingleTextTimestamp()
102
108
{
103
109
$ form = $ this ->factory ->create ('date ' , null , array (
104
110
'format ' => \IntlDateFormatter::MEDIUM ,
111
+ 'model_timezone ' => 'UTC ' ,
112
+ 'view_timezone ' => 'UTC ' ,
105
113
'widget ' => 'single_text ' ,
106
114
'input ' => 'timestamp ' ,
107
115
));
@@ -118,6 +126,8 @@ public function testSubmitFromSingleTextRaw()
118
126
{
119
127
$ form = $ this ->factory ->create ('date ' , null , array (
120
128
'format ' => \IntlDateFormatter::MEDIUM ,
129
+ 'model_timezone ' => 'UTC ' ,
130
+ 'view_timezone ' => 'UTC ' ,
121
131
'widget ' => 'single_text ' ,
122
132
'input ' => 'array ' ,
123
133
));
@@ -137,6 +147,8 @@ public function testSubmitFromSingleTextRaw()
137
147
public function testSubmitFromText ()
138
148
{
139
149
$ form = $ this ->factory ->create ('date ' , null , array (
150
+ 'model_timezone ' => 'UTC ' ,
151
+ 'view_timezone ' => 'UTC ' ,
140
152
'widget ' => 'text ' ,
141
153
));
142
154
@@ -157,6 +169,8 @@ public function testSubmitFromText()
157
169
public function testSubmitFromChoice ()
158
170
{
159
171
$ form = $ this ->factory ->create ('date ' , null , array (
172
+ 'model_timezone ' => 'UTC ' ,
173
+ 'view_timezone ' => 'UTC ' ,
160
174
'widget ' => 'choice ' ,
161
175
));
162
176
@@ -177,6 +191,8 @@ public function testSubmitFromChoice()
177
191
public function testSubmitFromChoiceEmpty ()
178
192
{
179
193
$ form = $ this ->factory ->create ('date ' , null , array (
194
+ 'model_timezone ' => 'UTC ' ,
195
+ 'view_timezone ' => 'UTC ' ,
180
196
'widget ' => 'choice ' ,
181
197
'required ' => false ,
182
198
));
@@ -196,6 +212,8 @@ public function testSubmitFromChoiceEmpty()
196
212
public function testSubmitFromInputDateTimeDifferentPattern ()
197
213
{
198
214
$ form = $ this ->factory ->create ('date ' , null , array (
215
+ 'model_timezone ' => 'UTC ' ,
216
+ 'view_timezone ' => 'UTC ' ,
199
217
'format ' => 'MM*yyyy*dd ' ,
200
218
'widget ' => 'single_text ' ,
201
219
'input ' => 'datetime ' ,
@@ -210,6 +228,8 @@ public function testSubmitFromInputDateTimeDifferentPattern()
210
228
public function testSubmitFromInputStringDifferentPattern ()
211
229
{
212
230
$ form = $ this ->factory ->create ('date ' , null , array (
231
+ 'model_timezone ' => 'UTC ' ,
232
+ 'view_timezone ' => 'UTC ' ,
213
233
'format ' => 'MM*yyyy*dd ' ,
214
234
'widget ' => 'single_text ' ,
215
235
'input ' => 'string ' ,
@@ -224,6 +244,8 @@ public function testSubmitFromInputStringDifferentPattern()
224
244
public function testSubmitFromInputTimestampDifferentPattern ()
225
245
{
226
246
$ form = $ this ->factory ->create ('date ' , null , array (
247
+ 'model_timezone ' => 'UTC ' ,
248
+ 'view_timezone ' => 'UTC ' ,
227
249
'format ' => 'MM*yyyy*dd ' ,
228
250
'widget ' => 'single_text ' ,
229
251
'input ' => 'timestamp ' ,
@@ -240,6 +262,8 @@ public function testSubmitFromInputTimestampDifferentPattern()
240
262
public function testSubmitFromInputRawDifferentPattern ()
241
263
{
242
264
$ form = $ this ->factory ->create ('date ' , null , array (
265
+ 'model_timezone ' => 'UTC ' ,
266
+ 'view_timezone ' => 'UTC ' ,
243
267
'format ' => 'MM*yyyy*dd ' ,
244
268
'widget ' => 'single_text ' ,
245
269
'input ' => 'array ' ,
@@ -358,10 +382,25 @@ public function testThrowExceptionIfDaysIsInvalid()
358
382
359
383
public function testSetDataWithDifferentNegativeUTCTimezoneDateTime ()
360
384
{
361
- date_default_timezone_set ('Pacific/Tahiti ' );
385
+ $ form = $ this ->factory ->create ('date ' , null , array (
386
+ 'format ' => \IntlDateFormatter::MEDIUM ,
387
+ 'model_timezone ' => 'America/New_York ' ,
388
+ 'view_timezone ' => 'Pacific/Tahiti ' ,
389
+ 'input ' => 'string ' ,
390
+ 'widget ' => 'single_text ' ,
391
+ ));
362
392
393
+ $ form ->setData ('2010-06-02 ' );
394
+
395
+ $ this ->assertEquals ('01.06.2010 ' , $ form ->getViewData ());
396
+ }
397
+
398
+ public function testSetDataWithDifferentTimezonesDateTime ()
399
+ {
363
400
$ form = $ this ->factory ->create ('date ' , null , array (
364
401
'format ' => \IntlDateFormatter::MEDIUM ,
402
+ 'model_timezone ' => 'America/New_York ' ,
403
+ 'view_timezone ' => 'Pacific/Tahiti ' ,
365
404
'input ' => 'datetime ' ,
366
405
'widget ' => 'single_text ' ,
367
406
));
@@ -371,7 +410,7 @@ public function testSetDataWithDifferentNegativeUTCTimezoneDateTime()
371
410
$ form ->setData ($ dateTime );
372
411
373
412
$ this ->assertDateTimeEquals ($ dateTime , $ form ->getData ());
374
- $ this ->assertEquals ('02 .06.2010 ' , $ form ->getViewData ());
413
+ $ this ->assertEquals ('01 .06.2010 ' , $ form ->getViewData ());
375
414
}
376
415
377
416
public function testSetDataWithDifferentPositiveUTCTimezoneDateTime ()
@@ -520,6 +559,8 @@ public function testIsPartiallyFilledReturnsFalseIfSingleText()
520
559
$ this ->markTestIncomplete ('Needs to be reimplemented using validators ' );
521
560
522
561
$ form = $ this ->factory ->create ('date ' , null , array (
562
+ 'model_timezone ' => 'UTC ' ,
563
+ 'view_timezone ' => 'UTC ' ,
523
564
'widget ' => 'single_text ' ,
524
565
));
525
566
@@ -533,6 +574,8 @@ public function testIsPartiallyFilledReturnsFalseIfChoiceAndCompletelyEmpty()
533
574
$ this ->markTestIncomplete ('Needs to be reimplemented using validators ' );
534
575
535
576
$ form = $ this ->factory ->create ('date ' , null , array (
577
+ 'model_timezone ' => 'UTC ' ,
578
+ 'view_timezone ' => 'UTC ' ,
536
579
'widget ' => 'choice ' ,
537
580
));
538
581
@@ -550,6 +593,8 @@ public function testIsPartiallyFilledReturnsFalseIfChoiceAndCompletelyFilled()
550
593
$ this ->markTestIncomplete ('Needs to be reimplemented using validators ' );
551
594
552
595
$ form = $ this ->factory ->create ('date ' , null , array (
596
+ 'model_timezone ' => 'UTC ' ,
597
+ 'view_timezone ' => 'UTC ' ,
553
598
'widget ' => 'choice ' ,
554
599
));
555
600
@@ -567,6 +612,8 @@ public function testIsPartiallyFilledReturnsTrueIfChoiceAndDayEmpty()
567
612
$ this ->markTestIncomplete ('Needs to be reimplemented using validators ' );
568
613
569
614
$ form = $ this ->factory ->create ('date ' , null , array (
615
+ 'model_timezone ' => 'UTC ' ,
616
+ 'view_timezone ' => 'UTC ' ,
570
617
'widget ' => 'choice ' ,
571
618
));
572
619
0 commit comments