Skip to content

Commit

Permalink
test: remove unnecessary timezone America/Chicago
Browse files Browse the repository at this point in the history
It is wrong to change the timezone only to setTestNow().
Remnants of the old code? Now UTC is the default timezone.
  • Loading branch information
kenjis committed Feb 29, 2024
1 parent 549db02 commit a14ea36
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tests/system/I18n/TimeLegacyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,31 +419,31 @@ public function testAgeNow(): void

public function testAgeFuture(): void
{
TimeLegacy::setTestNow('June 20, 2022', 'America/Chicago');
TimeLegacy::setTestNow('June 20, 2022');
$time = TimeLegacy::parse('August 12, 2116 4:15:23pm');

$this->assertSame(0, $time->getAge());
}

public function testGetAgeSameDayOfBirthday(): void
{
TimeLegacy::setTestNow('December 31, 2022', 'America/Chicago');
TimeLegacy::setTestNow('December 31, 2022');
$time = TimeLegacy::parse('December 31, 2020');

$this->assertSame(2, $time->getAge());
}

public function testGetAgeNextDayOfBirthday(): void
{
TimeLegacy::setTestNow('January 1, 2022', 'America/Chicago');
TimeLegacy::setTestNow('January 1, 2022');
$time = TimeLegacy::parse('December 31, 2020');

$this->assertSame(1, $time->getAge());
}

public function testGetAgeBeforeDayOfBirthday(): void
{
TimeLegacy::setTestNow('December 30, 2021', 'America/Chicago');
TimeLegacy::setTestNow('December 30, 2021');
$time = TimeLegacy::parse('December 31, 2020');

$this->assertSame(0, $time->getAge());
Expand Down
8 changes: 4 additions & 4 deletions tests/system/I18n/TimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,31 +426,31 @@ public function testAgeNow(): void

public function testAgeFuture(): void
{
Time::setTestNow('June 20, 2022', 'America/Chicago');
Time::setTestNow('June 20, 2022');
$time = Time::parse('August 12, 2116 4:15:23pm');

$this->assertSame(0, $time->getAge());
}

public function testGetAgeSameDayOfBirthday(): void
{
Time::setTestNow('December 31, 2022', 'America/Chicago');
Time::setTestNow('December 31, 2022');
$time = Time::parse('December 31, 2020');

$this->assertSame(2, $time->getAge());
}

public function testGetAgeNextDayOfBirthday(): void
{
Time::setTestNow('January 1, 2022', 'America/Chicago');
Time::setTestNow('January 1, 2022');
$time = Time::parse('December 31, 2020');

$this->assertSame(1, $time->getAge());
}

public function testGetAgeBeforeDayOfBirthday(): void
{
Time::setTestNow('December 30, 2021', 'America/Chicago');
Time::setTestNow('December 30, 2021');
$time = Time::parse('December 31, 2020');

$this->assertSame(0, $time->getAge());
Expand Down

0 comments on commit a14ea36

Please sign in to comment.