Make WordPress Core

Changeset 63640


Ignore:
Timestamp:
09/16/2026 05:45:47 PM (24 hours ago)
Author:
lancewillett
Message:

Tests: Restore state after functions tests.

Reset forced admin SSL to its configured startup value after each test. Resynchronize timezone translations with the restored locale after each timezone-choice test, preventing function-static state from leaking between tests.

Developed in: https://github.com/WordPress/wordpress-develop/pull/13182

Props jonsurrell, mindctrl.
See #65893.

Location:
trunk/tests/phpunit/tests/functions
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/functions/forceSslAdmin.php

    r60137 r63640  
    1515                // Reset the `$forced` static variable before each test.
    1616                force_ssl_admin( false );
     17        }
     18
     19        public function tear_down() {
     20                // Restore the boot-time value set by wp_ssl_constants().
     21                force_ssl_admin( FORCE_SSL_ADMIN );
     22
     23                parent::tear_down();
    1724        }
    1825
  • trunk/tests/phpunit/tests/functions/wpTimezoneChoice.php

    r62156 r63640  
    1111
    1212        /**
    13          * Restores the current locale after each test runs.
     13         * Restores the current locale and the timezone translations after each test runs.
    1414         */
    1515        public function tear_down(): void {
    1616                restore_current_locale();
     17                wp_timezone_choice( '', get_locale() );
     18
    1719                parent::tear_down();
    1820        }
Note: See TracChangeset for help on using the changeset viewer.