Tests: Reset current screen after setting it to dashboard in add_submenu_page() tests.

This avoids polluting other tests and allows the `ms-excluded` test group to successfully run on its own.

Props johnbillion, SergeyBiryukov.
See #52607.

git-svn-id: https://develop.svn.wordpress.org/trunk@50433 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2021-02-25 11:10:46 +00:00
parent 4a09e7d877
commit 274bc8b0ec

View File

@ -89,6 +89,8 @@ class Tests_Admin_includesPlugin extends WP_UnitTestCase {
// Clean up the temporary user.
wp_delete_user( $admin_user );
// Reset current screen.
set_current_screen( 'front' );
// Verify the menu was inserted at the expected position.
$this->assertSame( 'custom-position', $submenu[ $parent ][ $expected_position ][2] );
@ -197,6 +199,8 @@ class Tests_Admin_includesPlugin extends WP_UnitTestCase {
// Clean up the temporary user.
wp_delete_user( $admin_user );
// Reset current screen.
set_current_screen( 'front' );
foreach ( $actual_positions as $test => $actual_position ) {
// Verify the menu was inserted at the expected position.
@ -280,6 +284,8 @@ class Tests_Admin_includesPlugin extends WP_UnitTestCase {
// Clean up the temporary user.
wp_set_current_user( $current_user );
wp_delete_user( $admin_user );
// Reset current screen.
set_current_screen( 'front' );
// Verify the menu was inserted at the expected position.
$this->assertSame( 'main_slug', $submenu['main_slug'][0][2] );
@ -311,6 +317,8 @@ class Tests_Admin_includesPlugin extends WP_UnitTestCase {
// Clean up the temporary user.
wp_set_current_user( $current_user );
wp_delete_user( $admin_user );
// Reset current screen.
set_current_screen( 'front' );
// Verify the menu was inserted at the expected position.
$this->assertSame( 'submenu_page_1', $submenu['main_slug'][1][2] );