wordpress-develop/tests/phpunit/tests/theme
Joe McGill 03e46a7670 Themes: Make caches for block patterns clearable.
In [56765], theme block pattern files were cached to a transient as a performance enhancement. However, transients are not easily clearable when caches are flushed on environments not using a persistent cache, which can lead to errors if the theme files are renamed, edited, or moved.

This changes the caching mechanism to use `wp_cache_set()` instead, and caches these values to the global group so they are still persistent on environments using an object cache, and will be cleared by a cache flush.

In addition, the helper `_wp_get_block_patterns` has been moved `WP_Theme::get_block_patterns` for consistency with other block related theme methods and cache helpers for these values, `WP_Theme::get_pattern_cache` and `WP_Theme::set_pattern_cache`, have been made private.

Relevant unit tests updated.

Props: afercia, flixos90, mukesh27, joemcgill.
Fixes #59633. See #59591, #59490.


git-svn-id: https://develop.svn.wordpress.org/trunk@56978 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-20 19:06:46 +00:00
..
base.php Editor: Ensure global styles are rendered for third-party blocks. 2022-10-27 15:39:20 +00:00
customHeader.php Coding Standards: Include one space after function keyword for closures. 2023-09-12 15:21:02 +00:00
getThemeStarterContent.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
support.php Themes: Correct the logic for displaying a _doing_it_wrong() notice for add_theme_support( 'html5' ). 2022-03-07 14:42:49 +00:00
themeDir.php Editor: Improve performance of _register_theme_block_patterns function. 2023-10-03 15:16:55 +00:00
wpAddGlobalStylesForBlocks.php Script Loader: Replace hardcoded output of style tags with calls to wp_add_inline_style. 2023-09-25 17:04:41 +00:00
wpEnqueueStoredStyles.php Tests: Add test class for wp_enqueue_stored_styles(). 2023-03-20 18:20:05 +00:00
wpGetBlockCssSelector.php Coding Standards: Remove superfluous blank lines at the end of various files. 2023-09-07 14:57:30 +00:00
wpGetGlobalStylesheet.php Themes: Make caches for block patterns clearable. 2023-10-20 19:06:46 +00:00
wpTheme.php Themes: Account for a numeric theme directory in WP_Theme::__construct(). 2023-02-27 15:32:22 +00:00
wpThemeGetAllowedFilters.php Tests: Use more appropriate assertions in various tests. 2021-07-07 10:32:56 +00:00
wpThemeGetBlockPatterns.php Themes: Make caches for block patterns clearable. 2023-10-20 19:06:46 +00:00
wpThemeHasThemeJson.php Themes: Introduce wp_theme_has_theme_json() for public consumption. 2023-01-18 11:38:16 +00:00
wpThemeJson.php Editor: fix pattern alignment in editor view. 2023-09-19 01:43:07 +00:00
wpThemeJsonResolver.php Coding Standards: Include one space after function keyword for closures. 2023-09-12 15:21:02 +00:00
wpThemeJsonSchema.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2022-11-29 12:32:37 +00:00