From 1d5eba7879f1c8389ec1a949c6ad2bbf0f753e03 Mon Sep 17 00:00:00 2001 From: Mayank Majeji <2611064+mayankmajeji@users.noreply.github.com> Date: Thu, 26 Nov 2026 12:49:33 +0530 Subject: [PATCH 1/2] Tests: Reset the entity actions registry before each `Tests_Entity_Actions` test. The class only reset the registry after each test, so when an earlier class had read it, the first test of the class saw the actions WordPress registers instead of the test defaults. Reset it in `set_up()` as well. See #66755. --- tests/phpunit/tests/entity-actions.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/tests/entity-actions.php b/tests/phpunit/tests/entity-actions.php index 3951c15ee2d50..693d711f66bbc 100644 --- a/tests/phpunit/tests/entity-actions.php +++ b/tests/phpunit/tests/entity-actions.php @@ -26,12 +26,14 @@ class Tests_Entity_Actions extends WP_UnitTestCase { * the default actions of the tests, hooked at priority 0 as WordPress * registers its own, so every test runs against a registry holding * actions registered before the callbacks hooked at the default priority - * run. + * run. The registry is reset first, as an earlier test may have read it + * with the actions WordPress registers. */ public function set_up() { parent::set_up(); remove_action( 'wp_entity_actions_api_init', 'register_core_entity_actions', 0 ); add_action( 'wp_entity_actions_api_init', array( __CLASS__, 'register_default_actions' ), 0 ); + self::reset_registry(); } /** From 21ff9e9b9143a15987df4ffb0f8be5f4f887d789 Mon Sep 17 00:00:00 2001 From: Mayank Majeji <2611064+mayankmajeji@users.noreply.github.com> Date: Thu, 26 Nov 2026 18:34:51 +0530 Subject: [PATCH 2/2] Tests: Describe when the entity actions registry is reset. --- tests/phpunit/tests/entity-actions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/entity-actions.php b/tests/phpunit/tests/entity-actions.php index 693d711f66bbc..5e4ceb2c226a5 100644 --- a/tests/phpunit/tests/entity-actions.php +++ b/tests/phpunit/tests/entity-actions.php @@ -26,7 +26,7 @@ class Tests_Entity_Actions extends WP_UnitTestCase { * the default actions of the tests, hooked at priority 0 as WordPress * registers its own, so every test runs against a registry holding * actions registered before the callbacks hooked at the default priority - * run. The registry is reset first, as an earlier test may have read it + * run. It also resets the registry, as an earlier test may have read it * with the actions WordPress registers. */ public function set_up() {