Skip to content

Commit

Permalink
Merge pull request #6460 from kenjis/fix-test-restore-locales
Browse files Browse the repository at this point in the history
test: restore changed locale in Time tests
  • Loading branch information
kenjis authored Aug 31, 2022
2 parents 5b396db + 528eed7 commit 57385ea
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/system/I18n/TimeDifferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,23 @@
*/
final class TimeDifferenceTest extends CIUnitTestCase
{
private string $currentLocale;

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

helper('date');
Locale::setDefault('America/Chicago');

$this->currentLocale = Locale::getDefault();
Locale::setDefault('en-US');
}

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

Locale::setDefault($this->currentLocale);
}

public function testDifferenceBasics()
Expand Down
11 changes: 11 additions & 0 deletions tests/system/I18n/TimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,25 @@
*/
final class TimeTest extends CIUnitTestCase
{
private string $currentLocale;

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

helper('date');

$this->currentLocale = Locale::getDefault();
Locale::setDefault('en_US');
}

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

Locale::setDefault($this->currentLocale);
}

public function testNewTimeNow()
{
$formatter = new IntlDateFormatter(
Expand Down

0 comments on commit 57385ea

Please sign in to comment.