Skip to content

Commit f10e114

Browse files
committed
Tests: Reset the entity action registry before each entity action test.
Discard actions cached by an earlier test so the next registry read uses the default actions registered by the test class. Developed in: #16259 Props mayankmajeji, mukesh27. See #66755. git-svn-id: https://develop.svn.wordpress.org/trunk@65813 602fd350-edb4-49c9-b593-d223f7449a82
1 parent b37ad2c commit f10e114

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎tests/phpunit/tests/entity-actions.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ class Tests_Entity_Actions extends WP_UnitTestCase {
2626
* the default actions of the tests, hooked at priority 0 as WordPress
2727
* registers its own, so every test runs against a registry holding
2828
* actions registered before the callbacks hooked at the default priority
29-
* run.
29+
* run. It also resets the registry, as an earlier test may have read it
30+
* with the actions WordPress registers.
3031
*/
3132
public function set_up() {
3233
parent::set_up();
3334
remove_action( 'wp_entity_actions_api_init', 'register_core_entity_actions', 0 );
3435
add_action( 'wp_entity_actions_api_init', array( __CLASS__, 'register_default_actions' ), 0 );
36+
self::reset_registry();
3537
}
3638

3739
/**

0 commit comments

Comments
 (0)