Make WordPress Core


Ignore:
Timestamp:
07/13/2021 04:13:01 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Reset $current_screen global between tests to avoid cross-test interdependencies.

This provides a consistent global starting state for tests that interact with admin screens.

Individual tests no longer need to invoke set_current_screen( 'front' ) (or an alternative implementation) as a reset.

Follow-up to [29251], [29860], [31046], [36721], [38678], [48908], [50433].

Props hellofromTonya, johnbillion.
Fixes #53431.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/l10n/wpLocaleSwitcher.php

    r50456 r51419  
    285285        $wp_locale_switcher = $locale_switcher;
    286286
    287         set_current_screen( 'front' );
    288 
    289287        $this->assertFalse( $locale_switched_user_locale );
    290288        $this->assertTrue( $locale_switched_site_locale );
     
    336334        $wp_locale_switcher = $locale_switcher;
    337335
    338         set_current_screen( 'front' );
    339 
    340336        remove_filter( 'locale', array( $this, 'filter_locale' ) );
    341337
     
    383379        $wp_locale_switcher = $locale_switcher;
    384380
    385         set_current_screen( 'front' );
    386 
    387381        $this->assertSame( 'en_US', get_locale() );
    388382        $this->assertSame( 'This is a dummy plugin', $expected );
Note: See TracChangeset for help on using the changeset viewer.