1212
1313namespace tests \phpsap \DateTime ;
1414
15+ use DateTime ;
16+ use DateTimeZone ;
17+ use Exception ;
1518use phpsap \DateTime \SapDateTime ;
1619use PHPUnit \Framework \TestCase ;
1720
@@ -51,12 +54,12 @@ public static function validSapWeeks()
5154 * @param string $expected The expected week in format <year>W<week>.
5255 * @param string $timestamp The expected timestamp in format Y-m-d H:i:s
5356 * @dataProvider validSapWeeks
54- * @throws \ Exception
57+ * @throws Exception
5558 */
5659 public function testParseSapWeeks ($ sapWeek , $ expected , $ timestamp )
5760 {
5861 $ dateTime = SapDateTime::createFromFormat (SapDateTime::SAP_WEEK , $ sapWeek );
59- static ::assertInstanceOf (\ DateTime::class, $ dateTime );
62+ static ::assertInstanceOf (DateTime::class, $ dateTime );
6063 static ::assertSame ($ expected , $ dateTime ->format ('o \w\e\ek W ' ));
6164 static ::assertSame ($ timestamp , $ dateTime ->format ('Y-m-d H:i:s ' ));
6265 }
@@ -81,7 +84,7 @@ public static function invalidSapWeeks()
8184 *
8285 * @param string $sapWeek The SAP week string.
8386 * @dataProvider invalidSapWeeks
84- * @throws \ Exception
87+ * @throws Exception
8588 */
8689 public function testParseInvalidSapWeeks ($ sapWeek )
8790 {
@@ -110,7 +113,7 @@ public static function timestampsAndSapWeeks()
110113 * Test formatting timestamps to SAP week strings.
111114 * @param string $timestamp Timestamp string
112115 * @param string $expected SAP week string
113- * @throws \ Exception
116+ * @throws Exception
114117 * @dataProvider timestampsAndSapWeeks
115118 */
116119 public function testCreateSapWeeks ($ timestamp , $ expected )
@@ -141,7 +144,7 @@ public static function sapDatesAndIsoDates()
141144 * Test parsing SAP dates.
142145 * @param string $sapDate
143146 * @param string $isoDate
144- * @throws \ Exception
147+ * @throws Exception
145148 * @dataProvider sapDatesAndIsoDates
146149 */
147150 public function testParseSapDates ($ sapDate , $ isoDate )
@@ -168,7 +171,7 @@ public static function timesAndSapTimes()
168171 * Test formatting an ISO time as SAP time.
169172 * @param string $isoTime
170173 * @param string $sapTime
171- * @throws \ Exception
174+ * @throws Exception
172175 * @dataProvider timesAndSapTimes
173176 */
174177 public function testCreateSapTimes ($ isoTime , $ sapTime )
@@ -181,7 +184,7 @@ public function testCreateSapTimes($isoTime, $sapTime)
181184 * Test reading time from SAP and formatting it as ISO.
182185 * @param string $isoTime
183186 * @param string $sapTime
184- * @throws \ Exception
187+ * @throws Exception
185188 * @dataProvider timesAndSapTimes
186189 */
187190 public function testParseSapTimes ($ isoTime , $ sapTime )
@@ -211,7 +214,7 @@ public static function timestampsAndSapDates()
211214 * Test formatting DateTime objects as SAP dates.
212215 * @param string $timestamp
213216 * @param string $sapDate
214- * @throws \ Exception
217+ * @throws Exception
215218 * @dataProvider timestampsAndSapDates
216219 */
217220 public function testCreateSapDates ($ timestamp , $ sapDate )
@@ -241,7 +244,7 @@ public static function timestampsAndSapTimestamps()
241244 * Test parsing SAP timestamps.
242245 * @param string $isotime
243246 * @param string $saptime
244- * @throws \ Exception
247+ * @throws Exception
245248 * @dataProvider timestampsAndSapTimestamps
246249 */
247250 public function testParseSapTimestamps ($ isotime , $ saptime )
@@ -254,7 +257,7 @@ public function testParseSapTimestamps($isotime, $saptime)
254257 * Test formatting DateTime objects as SAP timestamps.
255258 * @param string $isotime
256259 * @param string $saptime
257- * @throws \ Exception
260+ * @throws Exception
258261 * @dataProvider timestampsAndSapTimestamps
259262 */
260263 public function testCreateSapTimestamps ($ isotime , $ saptime )
@@ -273,21 +276,21 @@ public static function provideTimezones()
273276 [
274277 SapDateTime::SAP_TIMESTAMP ,
275278 '20200301000102 ' ,
276- new \ DateTimeZone ('CET ' ),
279+ new DateTimeZone ('CET ' ),
277280 '2020-03-01T00:01:02+01:00 ' ,
278281 '2020-02-29T23:01:02+00:00 '
279282 ],
280283 [
281284 'Y-m-d H:i:s ' ,
282285 '2020-03-01 00:01:02 ' ,
283- new \ DateTimeZone ('CET ' ),
286+ new DateTimeZone ('CET ' ),
284287 '2020-03-01T00:01:02+01:00 ' ,
285288 '2020-02-29T23:01:02+00:00 '
286289 ],
287290 [
288291 SapDateTime::SAP_DATE ,
289292 '20200301 ' ,
290- new \ DateTimeZone ('CET ' ),
293+ new DateTimeZone ('CET ' ),
291294 '2020-03-01T00:00:00+01:00 ' ,
292295 '2020-02-29T23:00:00+00:00 '
293296 ]
@@ -299,16 +302,16 @@ public static function provideTimezones()
299302 * @dataProvider provideTimezones
300303 * @param string $format
301304 * @param string $time
302- * @param \ DateTimeZone $zone
305+ * @param DateTimeZone $zone
303306 * @param string $expected
304307 * @param string $utc
305- * @throws \ Exception
308+ * @throws Exception
306309 */
307310 public function testTimezones ($ format , $ time , $ zone , $ expected , $ utc )
308311 {
309312 $ dateTime = SapDateTime::createFromFormat ($ format , $ time , $ zone );
310313 static ::assertSame ($ expected , $ dateTime ->format ('c ' ));
311- $ dateTime ->setTimezone (new \ DateTimeZone ('UTC ' ));
314+ $ dateTime ->setTimezone (new DateTimeZone ('UTC ' ));
312315 static ::assertSame ($ utc , $ dateTime ->format ('c ' ));
313316 }
314317}
0 commit comments