Skip to content

Commit

Permalink
fix: Fixes timezone in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavofreze authored Jun 25, 2023
1 parent 790d2b1 commit 4dc20f7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/KsuidTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,16 @@ public function testFromPayloadAndTimestamp(): void
/**
* @dataProvider providerForTestInspectFrom
*/
public function testInspectFrom(string $ksuid, array $expected): void
public function testInspectFrom(string $ksuid, string $timezone, array $expected): void
{
$default = date_default_timezone_get();
date_default_timezone_set($timezone);

$actual = Ksuid::inspectFrom(ksuid: $ksuid);

self::assertEquals($expected, $actual);

date_default_timezone_set($default);
}

/**
Expand All @@ -95,6 +100,7 @@ public function providerForTestInspectFrom(): array
return [
[
'ksuid' => '2QzPUGEaAKHhVcQYrqQodbiZat1',
'timezone' => 'America/Sao_Paulo',
'expected' => [
'time' => '2023-06-09 20:30:50 -0300 -03',
'payload' => '464932c1194da98e752145d72b8f0aab',
Expand All @@ -103,6 +109,7 @@ public function providerForTestInspectFrom(): array
],
[
'ksuid' => '0ujzPyRiIAffKhBux4PvQdDqMHY',
'timezone' => 'America/Sao_Paulo',
'expected' => [
'time' => '2017-10-10 01:46:20 -0300 -03',
'payload' => '73fc1aa3b2446246d6e89fcd909e8fe8',
Expand Down

0 comments on commit 4dc20f7

Please sign in to comment.