Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions tests/phpunit/tests/entity-actions/registerCoreEntityActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,12 +483,31 @@ public function test_the_rest_route_serves_the_core_actions() {
* @ticket 66343
*/
public function test_the_script_modules_of_the_core_actions_are_registered() {
global $wp_script_modules, $wp_interactivity;

wp_set_current_user( self::$admin_id );

foreach ( wp_get_all_registered_entity_action_modules()['postType'] as $post_type => $modules ) {
foreach ( $modules as $module ) {
$this->assertNotNull( wp_script_modules()->get_registered( $module ), "The $module module of $post_type is registered." );
/*
* Register the default script modules in fresh instances, so the test neither
* depends on nor changes the shared ones. Registering them also marks the
* block library modules in the Interactivity API.
*/
$original_script_modules = $wp_script_modules;
$original_interactivity = $wp_interactivity;
$wp_script_modules = null;
$wp_interactivity = null;

try {
wp_default_script_modules();

foreach ( wp_get_all_registered_entity_action_modules()['postType'] as $post_type => $modules ) {
foreach ( $modules as $module ) {
$this->assertNotNull( wp_script_modules()->get_registered( $module ), "The $module module of $post_type is registered." );
}
}
} finally {
$wp_script_modules = $original_script_modules;
$wp_interactivity = $original_interactivity;
}
}

Expand Down
Loading