Commit 726f64b 1 parent 4deb6d0 commit 726f64b Copy full SHA for 726f64b
File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 16
16
use Carbon \Carbon ;
17
17
use Carbon \CarbonInterval ;
18
18
use Carbon \Translator ;
19
+ use DateTimeZone ;
19
20
use InvalidArgumentException ;
20
21
use Tests \AbstractTestCase ;
21
22
@@ -121,4 +122,23 @@ public function testDebugInfo()
121
122
's ' => 10 ,
122
123
], $ ci ->__debugInfo ());
123
124
}
125
+
126
+ public function testGetTimezone ()
127
+ {
128
+ $ this ->assertNull (CarbonInterval::day ()->tzName );
129
+ $ this ->assertSame (
130
+ 'America/New_York ' ,
131
+ CarbonInterval::day ()->setTimezone ('America/New_York ' )->tzName ,
132
+ );
133
+ $ this ->assertSame (
134
+ 'America/New_York ' ,
135
+ CarbonInterval::day ()->setTimezone (
136
+ new DateTimeZone ('America/New_York ' ),
137
+ )->tzName ,
138
+ );
139
+ $ this ->assertSame (
140
+ '+05:00 ' ,
141
+ CarbonInterval::day ()->setTimezone (5 )->tzName ,
142
+ );
143
+ }
124
144
}
You can’t perform that action at this time.
0 commit comments