wordpress-develop/tests/phpunit/tests
Pascal Birchler 9c8b1ba9ab I18N: Introduce WP_Textdomain_Registry to store text domains and their language directory paths.
Previously, when using `switch_to_locale()` all current loaded text domains were unloaded and added to the `$l10n_unloaded` global. This prevented the just-in-time loading for text domains after a switch. The just-in-time loading was also only possible if the translations were stored in `WP_LANG_DIR`. Both issues have been fixed.

* Adds `WP_Textdomain_Registry` to keep track of the language directory paths for all plugins and themes.
* Updates all `load_*_textdomain()`  functions to store the path in `WP_Textdomain_Registry`.
* Adds `$locale` parameter to `load_textdomain()` to specify the locale the translation file is for.
* Adds `$reloadable` parameter to `unload_textdomain()` to define whether a text domain can be loaded just-in-time again. This is used by `WP_Locale_Switcher::load_translations()`.
* Extends `_load_textdomain_just_in_time()` to also support text domains of plugins and themes with custom language directories.
* Fixes the incorrect `test_plugin_translation_after_switching_locale_twice()` test which should have caught this issue earlier.
* Adds a new test plugin and theme to test the loading of translations with a custom language directory.
* Deprecates the now unused and private `_get_path_to_translation()` and `_get_path_to_translation_from_lang_dir()` functions.

Previously added in [49236] and reverted in [49236] to investigate concerns which are now addressed here.

Props yoavf, swissspidy, dd32, ocean90.
See #26511.
Fixes #39210.

git-svn-id: https://develop.svn.wordpress.org/trunk@53874 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-11 12:37:05 +00:00
..
admin I18N: Introduce WP_Textdomain_Registry to store text domains and their language directory paths. 2022-08-11 12:37:05 +00:00
ajax Taxonomy: Allow filtering Ajax term search results in quick edit. 2022-07-26 13:21:55 +00:00
attachment Build/Test Tools: Add and fix @covers tags to the attachments and block-supports test groups. 2022-07-07 21:06:03 +00:00
block-supports Build/Test Tools: Add and fix @covers tags to the attachments and block-supports test groups. 2022-07-07 21:06:03 +00:00
blocks Editor: Safeguard has_blocks() against fatal errors. 2022-08-08 08:20:43 +00:00
bookmark General: Fix 'rel' argument in Tests_Functions_wpListBookmarks test datasets. 2021-12-21 00:10:26 +00:00
canonical Canonical: Check if the URL scheme exists in strip_fragment_from_url(). 2022-03-09 15:06:09 +00:00
category Build/Test Tools: Add @covers tags to the taxonomy and category test groups. 2022-07-07 23:00:07 +00:00
comment Build/Test Tools: Add @covers tags to the comments tests. 2022-08-08 23:12:30 +00:00
compat General: Introduce polyfills for str_ends_with() and str_starts_with() added in PHP 8.0. 2021-11-08 14:21:44 +00:00
cron Cron API: Modify _get_cron_array() to always return an array. 2022-07-29 03:32:58 +00:00
customize Code Modernization: Remove unused $undefined property in Tests_WP_Customize_Manager. 2022-08-07 16:36:42 +00:00
date Date/Time: Increase test coverage of wp_date(). 2022-08-01 22:48:42 +00:00
db Build/Test Tools: Correct the order and naming of expected and actual values in various tests. 2021-11-25 19:39:31 +00:00
dependencies Script Loader: Fix i18n edge case breaking dependencies. 2022-05-07 02:51:54 +00:00
editor Tests: Rename classes in phpunit/tests/editor/ per the naming conventions. 2021-08-20 16:11:04 +00:00
error-protection Tests: Rename classes in phpunit/tests/error-protection/ per the naming conventions. 2021-08-21 15:32:53 +00:00
external-http General: Bump the recommended MariaDB version in readme.html. 2022-05-23 14:20:47 +00:00
feed Administration: Change default site tagline to an empty string. 2022-08-03 12:18:22 +00:00
filesystem Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
formatting Formatting: Normalize to Unicode NFC encoding before converting accent characters in remove_accents(). 2022-07-21 21:09:56 +00:00
functions Code Modernization: Replace phpversion() function calls with PHP_VERSION constant. 2022-05-20 17:36:23 +00:00
general Tests: Rename the test class for wp_preload_resources() tests. 2022-08-06 00:03:01 +00:00
hooks Tests: Update the terminology used for action or filter names in hook tests. 2022-07-31 15:03:46 +00:00
http Tests: Use a consistent URL in HTTP response cookie tests. 2022-06-12 15:16:09 +00:00
image Media: enable generating multiple mime types for image uploads; specifically WebP versions for JPEG images by default. 2022-07-21 18:01:01 +00:00
import Build/Test Tools: Add @covers tags to the import tests. 2022-08-08 23:22:43 +00:00
includes Build/Test Tools: Switch to some more appropriate assertions. 2022-01-30 19:40:57 +00:00
l10n I18N: Introduce WP_Textdomain_Registry to store text domains and their language directory paths. 2022-08-11 12:37:05 +00:00
link Tests: Combine test classes for get_edit_term_link() tests. 2022-08-04 18:28:33 +00:00
load Build/Test Tools: Update @covers tags for the load tests. 2022-08-08 23:42:16 +00:00
media Code Modernization: Remove dynamic properties in Tests_Media_GetPostGalleries. 2022-08-07 14:32:55 +00:00
menu Build/Test Tools: Correct the order and naming of expected and actual values in various tests. 2021-11-25 19:39:31 +00:00
meta Code Modernization: Remove dynamic properties in Tests_*_Slashes. 2022-06-23 14:24:08 +00:00
multisite Networks and Sites: Improve cache key generation in WP_Network_Query class. 2022-04-07 17:57:59 +00:00
oembed Administration: Replace contracted verb forms for better consistency. 2022-03-22 16:23:32 +00:00
option Build/Test Tools: Add @covers tags to the options tests. 2022-08-08 23:33:11 +00:00
pluggable Tests: Correct an assertion in wp_rand() tests. 2022-06-08 13:17:27 +00:00
pomo Code Modernization: Remove dynamic properties in Tests_POMO_PO. 2022-08-07 13:56:35 +00:00
post Code Modernization: Remove dynamic properties in Tests_Post_Revisions. 2022-08-07 14:41:04 +00:00
privacy Tests: Require the zip PHP extension in block templates export file test. 2022-06-01 14:16:39 +00:00
query Query: Check if $wp_query is set in query loop functions. 2022-05-22 15:15:47 +00:00
rest-api Posts, Post Types: Force unique slugs for draft posts. 2022-08-03 09:01:05 +00:00
rewrite Tests: Improve the test for not throwing a warning on malformed date queries. 2022-08-08 14:38:08 +00:00
sitemaps Sitemaps: Prevent invalid provider names throwing errors. 2022-08-05 05:47:56 +00:00
taxonomy Build/Test Tools: Implement use of the void solution. 2021-08-07 10:29:41 +00:00
term Tests: Combine test classes for get_edit_term_link() tests. 2022-08-04 18:28:33 +00:00
theme I18N: Introduce WP_Textdomain_Registry to store text domains and their language directory paths. 2022-08-11 12:37:05 +00:00
url Tests: Remove @uses tags from the test suite. 2022-07-08 00:11:15 +00:00
user Cache API: Validate cache key in WP_Object_Cache methods. 2022-08-03 14:34:58 +00:00
webfonts Tests: Ignore EOL differences in Webfonts API tests. 2022-04-30 11:33:30 +00:00
widgets HTTP API: Revert changeset [52244]. 2021-12-06 21:29:00 +00:00
wp Docs: Add a @since note for WP::parse_request() about the new return value. 2022-03-02 15:38:27 +00:00
xmlrpc Build/Test Tools: Reduce the use of unnecessary randomness in tests. 2021-12-19 13:42:37 +00:00
actions.php Tests: Move the test for action callback representations to the general action tests file. 2022-07-31 21:35:40 +00:00
adminbar.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
auth.php Users: Prevent infinite loop when using capability checks during determine_current_user on multisite. 2021-11-15 01:08:35 +00:00
avatar.php Media: Add decoding="async" to image attributes. 2022-06-09 05:29:57 +00:00
basic.php Tests: Separate the tests in basic.php for clarity. 2022-07-07 23:55:13 +00:00
block-template-utils.php Tests: Require the zip PHP extension in block templates export file test. 2022-06-01 14:16:39 +00:00
block-template.php Site Editor: Resolve homepage template on server-side 2022-04-07 13:33:03 +00:00
cache.php Tests: Use named data provider for WP_Object_Cache::is_valid_key() test. 2022-08-04 17:47:41 +00:00
canonical.php Canonical: Include all public status in 404 redirects. 2022-04-01 03:23:07 +00:00
category.php Build/Test Tools: Add @covers tags to the taxonomy and category test groups. 2022-07-07 23:00:07 +00:00
comment-submission.php Build/Test Tools: Add @covers tags to the comments tests. 2022-08-08 23:12:30 +00:00
comment.php Build/Test Tools: Add @covers tags to the comments tests. 2022-08-08 23:12:30 +00:00
cron.php Cron API: Modify _get_cron_array() to always return an array. 2022-07-29 03:32:58 +00:00
db.php Database: Ensure MySQL port numbers are numeric in wpdb. 2022-07-06 05:31:47 +00:00
dbdelta.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
dependencies.php Script Loader: Allow for wp_register_script() to be called after wp_enqueue_script(). 2021-12-07 17:44:46 +00:00
file.php Code Modernization: Remove dynamic properties in Tests_File. 2022-08-07 14:48:42 +00:00
filters.php Tests: Update the terminology used for action or filter names in MockAction class. 2022-07-31 16:25:27 +00:00
functions.php Tests: Add some test cases for path_join() with Windows paths. 2022-06-03 15:05:28 +00:00
https-detection.php Coding Standards: Use static closures when not using $this. 2021-08-26 12:57:08 +00:00
https-migration.php Coding Standards: Use static closures when not using $this. 2021-08-26 12:57:08 +00:00
kses.php Docs: Remove @return void from various DocBlocks. 2022-05-02 13:11:07 +00:00
l10n.php Build/Test Tools: Add @covers tags to the l10n and i18n tests. 2022-08-08 23:39:06 +00:00
link.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
locale.php Build/Test Tools: Add @covers tags to the l10n and i18n tests. 2022-08-08 23:39:06 +00:00
mail.php Tests: Rename the $success variable to $result in the wp_mail() test for an empty home URL. 2022-02-25 14:08:53 +00:00
media.php Tests: Simplify some function calls in Tests_Media. 2022-07-29 14:33:15 +00:00
meta.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
multisite.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
pluggable.php Cache API: Make the placement of wp_cache_flush_group() more consistent. 2022-07-23 14:56:51 +00:00
post.php Tests: Don't unnecessarily set the author in some wp_insert_post() tests. 2022-07-27 15:41:30 +00:00
query.php Tests: Improve the test for not throwing a warning on malformed date queries. 2022-08-08 14:38:08 +00:00
rest-api.php REST API: Respect _fields query arg in preloaded requests 2022-04-19 14:38:16 +00:00
rewrite.php Build/Test Tools: Reduce the use of unnecessary randomness in tests. 2021-12-19 13:42:37 +00:00
robots.php Coding Standards: Use static closures when not using $this. 2021-08-26 12:57:08 +00:00
shortcode.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
site-health.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
taxonomy.php Taxonomy: Prevent non string taxonomy names generating warnings or errors. 2022-08-09 10:21:32 +00:00
template.php Build/Test Tools: Implement use of the void solution. 2021-08-07 10:29:41 +00:00
term.php Tests: Include special characters in term names for wp_set_term_objects(). 2022-03-16 03:04:40 +00:00
theme.php Tests: Improve the logic of the SECURITY.md test to check all supported versions. 2022-05-06 11:09:54 +00:00
upload.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
url.php Tests: Remove @uses tags from the test suite. 2022-07-08 00:11:15 +00:00
user.php Cache API: Validate cache key in WP_Object_Cache methods. 2022-08-03 14:34:58 +00:00
utils.php Tests: Separate the tests in basic.php for clarity. 2022-07-07 23:55:13 +00:00
walker.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
widgets.php Tests: Use a simpler approach to test the output in some tests. 2021-11-27 16:16:15 +00:00
wp.php Build/Test Tools: Implement use of the void solution. 2021-08-07 10:29:41 +00:00