Skip to content
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

2.x Fix tests in #2614 #2621

Merged
merged 6 commits into from Jul 29, 2022
Merged

2.x Fix tests in #2614 #2621

merged 6 commits into from Jul 29, 2022

Conversation

gchtr
Copy link
Member

@gchtr gchtr commented Jul 29, 2022

Ticket: #2614

Issue

There are some testing issues in #2614.

Solution

This pull request:

  • Fixes WPML tests by restoring a missing mock function in 7159c3d.
  • Fixes some instances of restoring the current locale in 07838be.
  • Refactors the Twig translation tests in 826dd05. I added a custom timber-test.php file to add the translations that can be read by the wp i18n command and be saved in test/languages/timber-test.pot. In the tests, we then use the hardcoded "timber-test" text domain and load it using load_textdomain() instead of somehow loading the translations for the Twenty Fiften theme and adding custom translations there.

Impact

None.

Usage Changes

None.

Considerations

I ran into some issues when using composer cs:fix. It just added whitespace to the test files and added more whitespace if I ran composer cs:fix multiple times.

Testing

Yes.

Use a custom timber-test.php file to add the translations that can be read by the wp i18n command and saved in test/languages/timber-test.pot. In the tests, we then use the hardcoded "timber-test" text domain and load it using load_textdomain().
@gchtr gchtr added the 2.0 label Jul 29, 2022
@gchtr gchtr requested a review from nlemoine July 29, 2022 07:19
@gchtr
Copy link
Member Author

gchtr commented Jul 29, 2022

@nlemoine Could you look at the issue where ecs check reports missing whitespace that shouldn’t be added, the way I see it? This causes the tests to fail.

Copy link
Member

@nlemoine nlemoine left a comment

Choose a reason for hiding this comment

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

Looks like some test files had a wrong indentation and the fixers do not play nice with this.

I made a PR to fix this in #2622

@gchtr gchtr requested a review from nlemoine July 29, 2022 08:16
@gchtr
Copy link
Member Author

gchtr commented Jul 29, 2022

@nlemoine Ooops, sorry for re-requesting the review, you already gave the good to go… I’m merging this 👍

@gchtr gchtr merged commit f2fcd45 into 2.x-update-tests Jul 29, 2022
@gchtr gchtr deleted the 2.x-update-tests-fix branch July 29, 2022 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants