WordPress.org

Make WordPress Core

Changeset 48914


Ignore:
Timestamp:
08/31/2020 05:51:23 PM (5 months ago)
Author:
desrosj
Message:

Tests: Reset the $wp_sitemap global after each test, so that sitemaps are re-initialized when the next test runs.

This ensures consistent results in query var tests, regardless of whether they are run in isolation or as part of a larger group of tests.

Props pbiron, peterwilsoncc.
Merges [48908] to the 5.5 branch.
Fixes #51154.

Location:
branches/5.5
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/5.5

  • branches/5.5/tests/phpunit/includes/abstract-testcase.php

    r48464 r48914  
    161161            $GLOBALS[ $global ] = null;
    162162        }
     163
     164        // Reset $wp_sitemap global so that sitemap-related dynamic $wp->public_query_vars are added when the next test runs.
     165        $GLOBALS['wp_sitemaps'] = null;
    163166
    164167        $this->unregister_all_meta_keys();
  • branches/5.5/tests/phpunit/tests/query/vars.php

    r47018 r48914  
    1010    /**
    1111     * @ticket 35115
     12     * @ticket 51154
    1213     */
    1314    public function testPublicQueryVarsAreAsExpected() {
     
    7172                'post_format',
    7273                'rest_route',
     74                'sitemap',
     75                'sitemap-subtype',
     76                'sitemap-stylesheet',
    7377
    7478            ),
Note: See TracChangeset for help on using the changeset viewer.