mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
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], [55148], and [55155], the cache is currently ignored when `WP_DEBUG` is on to avoid interrupting the theme developer's workflow. Props spacedmonkey, oandregal, flixos90, ajlende, hellofromtonya. Fixes #57568. git-svn-id: https://develop.svn.wordpress.org/trunk@55185 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
37
tests/phpunit/tests/theme/wpGetGlobalStylesSvgFilters.php
Normal file
37
tests/phpunit/tests/theme/wpGetGlobalStylesSvgFilters.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Tests wp_get_global_styles_svg_filters().
|
||||
*
|
||||
* @group themes
|
||||
*/
|
||||
class Tests_Theme_wpGetGlobalStylesSvgFilters extends WP_UnitTestCase {
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
// Clear caches.
|
||||
wp_clean_themes_cache();
|
||||
}
|
||||
|
||||
public function tear_down() {
|
||||
wp_clean_themes_cache();
|
||||
|
||||
parent::tear_down();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that switching themes recalculates the svgs.
|
||||
*
|
||||
* @covers ::wp_get_global_styles_svg_filters
|
||||
*
|
||||
* @ticket 57568
|
||||
*/
|
||||
public function test_switching_themes_should_recalculate_svg() {
|
||||
$svg_for_default_theme = wp_get_global_styles_svg_filters();
|
||||
switch_theme( 'block-theme' );
|
||||
$svg_for_block_theme = wp_get_global_styles_svg_filters();
|
||||
switch_theme( WP_DEFAULT_THEME );
|
||||
|
||||
$this->assertStringContainsString( '<svg', $svg_for_default_theme, 'Default theme should contain SVG' );
|
||||
$this->assertStringContainsString( '<svg', $svg_for_default_theme, 'Block theme should contain SVG' );
|
||||
$this->assertNotSame( $svg_for_default_theme, $svg_for_block_theme, 'Cache value should have changed' );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user