From b26821c61b5d47d541d3922b2d14a60f428ff08a Mon Sep 17 00:00:00 2001 From: Mayank Majeji <2611064+mayankmajeji@users.noreply.github.com> Date: Thu, 26 Nov 2026 02:22:46 +0530 Subject: [PATCH 1/2] Tests: Clear the unloaded text domains after each `WP_Translation_Controller_Tests` test. When an earlier class left `internationalized-plugin` translations loaded, the class's own `tear_down()` marked the domain as unloaded, so a later test of the class could not load it and left the locale switched for the rest of the run. Unset `$l10n_unloaded` after unloading, as the just-in-time loading and locale switcher tests do. See #66755. --- tests/phpunit/tests/l10n/wpTranslationController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/phpunit/tests/l10n/wpTranslationController.php b/tests/phpunit/tests/l10n/wpTranslationController.php index 00afeaa095cea..7aa910a44bb70 100644 --- a/tests/phpunit/tests/l10n/wpTranslationController.php +++ b/tests/phpunit/tests/l10n/wpTranslationController.php @@ -9,6 +9,7 @@ public function tear_down() { remove_all_filters( 'translation_file_format' ); unload_textdomain( 'wp-tests-domain' ); unload_textdomain( 'internationalized-plugin' ); + unset( $GLOBALS['l10n_unloaded'] ); parent::tear_down(); } From 14604f64ab41a850eb1a2838e66f5363b8bea1d6 Mon Sep 17 00:00:00 2001 From: Mayank Majeji <2611064+mayankmajeji@users.noreply.github.com> Date: Thu, 26 Nov 2026 10:50:43 +0530 Subject: [PATCH 2/2] Tests: Only clear the two text domains the class unloads. Unsetting all of `$l10n_unloaded` would make unrelated domains eligible for just-in-time loading again. --- tests/phpunit/tests/l10n/wpTranslationController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/l10n/wpTranslationController.php b/tests/phpunit/tests/l10n/wpTranslationController.php index 7aa910a44bb70..22088b52ce38c 100644 --- a/tests/phpunit/tests/l10n/wpTranslationController.php +++ b/tests/phpunit/tests/l10n/wpTranslationController.php @@ -9,7 +9,7 @@ public function tear_down() { remove_all_filters( 'translation_file_format' ); unload_textdomain( 'wp-tests-domain' ); unload_textdomain( 'internationalized-plugin' ); - unset( $GLOBALS['l10n_unloaded'] ); + unset( $GLOBALS['l10n_unloaded']['wp-tests-domain'], $GLOBALS['l10n_unloaded']['internationalized-plugin'] ); parent::tear_down(); }