Make WordPress Core


Ignore:
Timestamp:
01/26/2023 11:01:10 PM (2 years ago)
Author:
flixos90
Message:

Editor: Use a non-persistent object cache instead of transient in wp_get_global_stylesheet().

This changeset is part of a greater effort to enhance the caching strategy for theme.json based data. Similar to [55138], the cache is currently ignored when WP_DEBUG is on to avoid interrupting the theme developer's workflow.

Props oandregal, spacedmonkey, hellofromtonya, flixos90, ironprogrammer, azaozz, aristath, costdev, mcsf.
Fixes #56910.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/theme/wpGetGlobalStylesheet.php

    r54214 r55148  
    271271        );
    272272    }
     273    /**
     274     * Tests that switching themes recalculates the stylesheet.
     275     *
     276     * @ticket 56970
     277     */
     278    public function test_switching_themes_should_recalculate_stylesheet() {
     279        $stylesheet_for_default_theme = wp_get_global_stylesheet();
     280        switch_theme( 'block-theme' );
     281        $stylesheet_for_block_theme = wp_get_global_stylesheet();
     282        switch_theme( WP_DEFAULT_THEME );
     283
     284        $this->assertStringNotContainsString( '--wp--preset--font-size--custom: 100px;', $stylesheet_for_default_theme, 'custom font size (100px) not present for default theme' );
     285        $this->assertStringContainsString( '--wp--preset--font-size--custom: 100px;', $stylesheet_for_block_theme, 'custom font size (100px) is present for block theme' );
     286    }
    273287}
Note: See TracChangeset for help on using the changeset viewer.