Skip to content

Commit

Permalink
minor symfony#50865 [VarDumper] enforce UTC timezone in test (xabbuh)
Browse files Browse the repository at this point in the history
This PR was merged into the 5.4 branch.

Discussion
----------

[VarDumper] enforce UTC timezone in test

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

This should fix the failing VarDumper tests on AppVeyor.

Commits
-------

5473840 enforce UTC timezone in test
  • Loading branch information
xabbuh committed Jul 4, 2023
2 parents 1e1d91e + 5473840 commit d3b33d9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Symfony/Component/VarDumper/Tests/Caster/DateCasterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@ class DateCasterTest extends TestCase
{
use VarDumperTestTrait;

private $previousTimezone;

protected function setUp(): void
{
parent::setUp();

$this->previousTimezone = date_default_timezone_get();
}

protected function tearDown(): void
{
parent::tearDown();

date_default_timezone_set($this->previousTimezone);
}

/**
* @dataProvider provideDateTimes
*/
Expand Down Expand Up @@ -95,6 +111,8 @@ public static function provideDateTimes()
*/
public function testCastDateTimeNoTimezone($time, $xDate, $xInfos)
{
date_default_timezone_set('UTC');

$stub = new Stub();
$date = new NoTimezoneDate($time);
$cast = DateCaster::castDateTime($date, Caster::castObject($date, \DateTime::class), $stub, false, 0);
Expand Down

0 comments on commit d3b33d9

Please sign in to comment.