@@ -14,8 +14,6 @@ public function setUp()
1414
1515 public function testNewTimeNow ()
1616 {
17- $ time = new Time (null , 'America/Chicago ' );
18-
1917 $ formatter = new IntlDateFormatter (
2018 'en_US ' ,
2119 IntlDateFormatter::SHORT ,
@@ -25,13 +23,13 @@ public function testNewTimeNow()
2523 'yyyy-MM-dd HH:mm:ss '
2624 );
2725
26+ $ time = new Time (null , 'America/Chicago ' );
27+
2828 $ this ->assertEquals ($ formatter ->format (strtotime ('now ' )), (string )$ time );
2929 }
3030
3131 public function testTimeWithTimezone ()
3232 {
33- $ time = new Time ('now ' , 'Europe/London ' );
34-
3533 $ formatter = new IntlDateFormatter (
3634 'en_US ' ,
3735 IntlDateFormatter::SHORT ,
@@ -41,13 +39,13 @@ public function testTimeWithTimezone()
4139 'yyyy-MM-dd HH:mm:ss '
4240 );
4341
42+ $ time = new Time ('now ' , 'Europe/London ' );
43+
4444 $ this ->assertEquals ($ formatter ->format (strtotime ('now ' )), (string )$ time );
4545 }
4646
4747 public function testTimeWithTimezoneAndLocale ()
4848 {
49- $ time = new Time ('now ' , 'Europe/London ' , 'fr_FR ' );
50-
5149 $ formatter = new IntlDateFormatter (
5250 'fr_FR ' ,
5351 IntlDateFormatter::SHORT ,
@@ -57,13 +55,13 @@ public function testTimeWithTimezoneAndLocale()
5755 'yyyy-MM-dd HH:mm:ss '
5856 );
5957
58+ $ time = new Time ('now ' , 'Europe/London ' , 'fr_FR ' );
59+
6060 $ this ->assertEquals ($ formatter ->format (strtotime ('now ' )), (string )$ time );
6161 }
6262
6363 public function testTimeWithDateTimeZone ()
6464 {
65- $ time = new Time ('now ' , new \DateTimeZone ('Europe/London ' ), 'fr_FR ' );
66-
6765 $ formatter = new IntlDateFormatter (
6866 'fr_FR ' ,
6967 IntlDateFormatter::SHORT ,
@@ -73,6 +71,8 @@ public function testTimeWithDateTimeZone()
7371 'yyyy-MM-dd HH:mm:ss '
7472 );
7573
74+ $ time = new Time ('now ' , new \DateTimeZone ('Europe/London ' ), 'fr_FR ' );
75+
7676 $ this ->assertEquals ($ formatter ->format (strtotime ('now ' )), (string )$ time );
7777 }
7878
0 commit comments