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

Tests: Fix _load_textdomain_just_in_time PHP Notice #747

Merged
merged 28 commits into from
Nov 27, 2024

Conversation

n7studios
Copy link
Contributor

@n7studios n7studios commented Nov 25, 2024

Summary

WordPress 6.7 displays a PHP notice if a Theme or Plugin calls load_plugin_textdomain too early i.e. before the WordPress init hook and WP_DEBUG is enabled.

This Plugin's tests run with WP_DEBUG enabled, and due to activating third party Plugins to run specific tests against, we get errors:
Screenshot 2024-11-25 at 13 10 30

This PR resolves by suppressing the _load_textdomain_just_in_time PHP notice in our automated testing via use of a Plugin, whilst allowing other notices to still display and be detected.

Also fixes cron tests failing due to a change in the admin UI URL in WP Crontrol 1.17.1, released November 23rd.

Testing

Existing tests pass.

Checklist

@n7studios n7studios self-assigned this Nov 25, 2024
@n7studios n7studios requested review from a team, noelherrick and corydhmiller and removed request for a team November 25, 2024 12:50
@n7studios n7studios marked this pull request as ready for review November 25, 2024 12:50
… into add-block-visibility-support-non-inline-forms
Copy link
Contributor

@noelherrick noelherrick left a comment

Choose a reason for hiding this comment

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

Would this still catch errors in the Kit plugin if it made this mistake?

@n7studios
Copy link
Contributor Author

Would this still catch errors in the Kit plugin if it made this mistake?

It only suppresses the _load_textdomain_just_in_time error, caused by third party Plugins calling load_plugin_textdomain too early:
https://stackoverflow.com/questions/79198701/notice-function-load-textdomain-just-in-time-was-called-incorrectly

We load our language files correctly by using the init hook, so the Kit plugin won't be triggering this:
https://github.com/Kit/convertkit-wordpress/blob/main/includes/class-wp-convertkit.php#L51

…ine-forms

Block Visibility: Support non-inline Forms
Fix character encoding when inserting Form after specific HTML element
@n7studios n7studios merged commit 5d38edf into main Nov 27, 2024
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.

2 participants