@@ -72,5 +72,35 @@ public function testDateTimeExceptionalFormatsThatShouldBeValid()
72
72
$ this ->dateValidator = new Date ('r ' );
73
73
$ this ->assertTrue ($ this ->dateValidator ->assert ('Thu, 29 Dec 2005 01:02:03 +0000 ' ));
74
74
}
75
+
76
+ /**
77
+ * Test that datetime strings with timezone information are valid independent on the system's timezone setting.
78
+ *
79
+ * @param string $systemTimezone
80
+ * @param string $input
81
+ * @dataProvider providerForDateTimeTimezoneStrings
82
+ */
83
+ public function testDateTimeSystemTimezoneIndependent ($ systemTimezone , $ format , $ input )
84
+ {
85
+ date_default_timezone_set ($ systemTimezone );
86
+ $ this ->dateValidator = new Date ($ format );
87
+ $ this ->assertTrue ($ this ->dateValidator ->assert ($ input ));
88
+ }
89
+
90
+ /**
91
+ *
92
+ * @return array
93
+ */
94
+ public function providerForDateTimeTimezoneStrings (){
95
+ return array (
96
+ array ('UTC ' , 'c ' , '2005-12-30T01:02:03+01:00 ' ,),
97
+ array ('UTC ' , 'c ' , '2004-02-12T15:19:21+00:00 ' ,),
98
+ array ('UTC ' , 'r ' , 'Thu, 29 Dec 2005 01:02:03 +0000 ' ,),
99
+ array ('Europe/Amsterdam ' , 'c ' , '2005-12-30T01:02:03+01:00 ' ,),
100
+ array ('Europe/Amsterdam ' , 'c ' , '2004-02-12T15:19:21+00:00 ' ,),
101
+ array ('Europe/Amsterdam ' , 'r ' , 'Thu, 29 Dec 2005 01:02:03 +0000 ' ,),
102
+ );
103
+ }
104
+
75
105
}
76
106
0 commit comments