[wp-trac] [WordPress Trac] #52607: Investigate why the ms-excluded test group fails when run on its own

WordPress Trac noreply at wordpress.org
Mon Feb 22 22:39:16 UTC 2021


#52607: Investigate why the ms-excluded test group fails when run on its own
----------------------------------------+------------------------------
 Reporter:  johnbillion                 |       Owner:  (none)
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  Build/Test Tools            |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  needs-unit-tests has-patch  |     Focuses:  multisite
----------------------------------------+------------------------------
Changes (by SergeyBiryukov):

 * keywords:  needs-unit-tests => needs-unit-tests has-patch


Comment:

 This appears to be caused by `set_current_screen( 'dashboard' )` in
 `test_submenu_helpers_position()`, which then causes the `is_admin()`
 check in `wp_admin_bar_site_menu()` to return `true` and switch the link
 to "Visit Site" instead of "Dashboard".

 I thought the `$current_screen` global would be reset between tests, but
 that is not the case, so apparently each test is responsible for cleaning
 this up after using `set_current_screen()`.

 [attachment:"52607.diff"] is based on a similar routine from
 `Tests_Admin_includesScreen`, or perhaps each of the four tests in
 `Tests_Admin_includesPlugin` that use `set_current_screen()` should clean
 this up separately.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52607#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list