Skip to content

test: restore changed locale in Time tests #6460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 31, 2022

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Aug 31, 2022

Description
A test class should not change the global state.

Checklist:

  • Securely signed commits
  • [] Component(s) with PHPDoc blocks, only if necessary or adds value
  • [] Unit testing, with >80% coverage
  • [] User guide updated
  • Conforms to style guide

@kenjis kenjis added the testing Pull requests that changes tests only label Aug 31, 2022
@kenjis kenjis changed the title test: restore changed locale in tearDown() test: restore changed locale in Time tests Aug 31, 2022
protected function setUp(): void
{
parent::setUp();

helper('date');

$this->currentLocale = Locale::getDefault();
Locale::setDefault('America/Chicago');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameter locale Is a BCP 47 compliant language tag. Is a BCP 47 compliant language tag.
I thought the input of the function should be en-US, not America/Chicago!
https://www.php.net/manual/en/locale.setdefault.php

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Contributor

@datamweb datamweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!🥀🥀

@kenjis kenjis merged commit 57385ea into codeigniter4:develop Aug 31, 2022
@kenjis kenjis deleted the fix-test-restore-locales branch August 31, 2022 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Pull requests that changes tests only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants