Skip to content

Commit 5774ae9

Browse files
Merge branch '5.4' into 6.2
* 5.4: cs fix [Messenger] Fix passing options set via tags to handler descriptors random_bytes length should be an int greater than 0 enforce UTC timezone in test [DependencyInjection] Fix autocasting null env values to empty string Fix executable bit Readme: Replace Stack Overflow with GitHub Discussions [DependencyInjection] Fix annotation [String] Fix Inflector for 'status' [EventDispatcher] [EventDispatcher] Throw exception when listener method cannot be resolved
2 parents facbf30 + 4684507 commit 5774ae9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Tests/Caster/DateCasterTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ class DateCasterTest extends TestCase
2525
{
2626
use VarDumperTestTrait;
2727

28+
private $previousTimezone;
29+
30+
protected function setUp(): void
31+
{
32+
parent::setUp();
33+
34+
$this->previousTimezone = date_default_timezone_get();
35+
}
36+
37+
protected function tearDown(): void
38+
{
39+
parent::tearDown();
40+
41+
date_default_timezone_set($this->previousTimezone);
42+
}
43+
2844
/**
2945
* @dataProvider provideDateTimes
3046
*/
@@ -111,6 +127,8 @@ public static function provideDateTimes()
111127
*/
112128
public function testCastDateTimeNoTimezone($time, $xDate, $xInfos)
113129
{
130+
date_default_timezone_set('UTC');
131+
114132
$stub = new Stub();
115133
$date = new NoTimezoneDate($time);
116134
$cast = DateCaster::castDateTime($date, Caster::castObject($date, \DateTime::class), $stub, false, 0);

0 commit comments

Comments
 (0)