[wp-trac] [WordPress Trac] #39210: switch_to_locale() unloads all plugin and theme translations
WordPress Trac
noreply at wordpress.org
Fri Aug 12 14:59:18 UTC 2022
#39210: switch_to_locale() unloads all plugin and theme translations
-------------------------------------------------+-------------------------
Reporter: gchtr | Owner: ocean90
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 6.1
Component: I18N | Version: 4.7
Severity: normal | Resolution: fixed
Keywords: has-unit-tests has-patch needs-dev- | Focuses:
note |
-------------------------------------------------+-------------------------
Comment (by aaemnnosttv):
https://core.trac.wordpress.org/changeset/53874#file28 introduces a
substantial change to the PHPUnit `bootstrap.php` which will break tests
for any plugin or theme which defines a custom path for the
`WP_PLUGIN_DIR` constant which was never defined by core for tests before.
This has already broken tests running on the nightly version of WordPress
for Google Site Kit which is what brought this to my attention.
A quick search on GitHub shows many code matches for this constant in
files under `tests`, including WordPress repos (e.g.
wordpress/performance), and Yoast extensions for WooCommerce and News.
https://github.com/search?q=%22define%28+%27WP_PLUGIN_DIR%27%22+path%3Atests+language%3APHP+language%3APHP&type=Code&ref=advsearch&l=PHP&l=PHP
What can't be quantified are all the other cases where the constant is
preferred to be left **undefined**, using the default definition of `wp-
content/plugins`, for example a project running tests in a specific
configuration, e.g. https://github.com/wp-phpunit/example-project
If possible, I would ask that this constant is defined conditionally, only
if core tests are being run, rather than unconditionally as it is now to
avoid such breaking changes.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39210#comment:57>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list