wordpress-develop/tests/phpunit/tests/theme
Tonya Mork 6a9e92dc76 Themes: Introduce wp_theme_has_theme_json() for public consumption.
Adds `wp_theme_has_theme_json()` for public consumption, to replace the private internal Core-only `WP_Theme_JSON_Resolver::theme_has_support()` method. This new global function checks if a theme or its parent has a `theme.json` file.

For performance, results are cached as an integer `1` or `0` in the `'theme_json'` group with `'wp_theme_has_theme_json'` key. This is a non-persistent cache. Why? To make the derived data from `theme.json` is always fresh from the potential modifications done via hooks that can use dynamic data (modify the stylesheet depending on some option, settings depending on user permissions, etc.).

Also adds a new public function `wp_clean_theme_json_cache()` to clear the cache on `'switch_theme'` and `start_previewing_theme'`.

References:
* [https://github.com/WordPress/gutenberg/pull/45168 Gutenberg PR 45168] Add `wp_theme_has_theme_json` as a public API to know whether a theme has a `theme.json`.
* [https://github.com/WordPress/gutenberg/pull/45380 Gutenberg PR 45380] Deprecate `WP_Theme_JSON_Resolver:theme_has_support()`.
* [https://github.com/WordPress/gutenberg/pull/46150 Gutenberg PR 46150] Make `theme.json` object caches non-persistent.
* [https://github.com/WordPress/gutenberg/pull/45979 Gutenberg PR 45979] Don't check if constants set by `wp_initial_constants()` are defined.
* [https://github.com/WordPress/gutenberg/pull/45950 Gutenberg PR 45950] Cleaner logic in `wp_theme_has_theme_json`.

Follow-up to [54493], [53282], [52744], [52049], [50959].

Props oandregal, afragen, alexstine, aristath, azaozz, costdev, flixos90, hellofromTonya, mamaduka, mcsf, ocean90, spacedmonkey.
Fixes #56975.

git-svn-id: https://develop.svn.wordpress.org/trunk@55086 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-18 11:38:16 +00:00
..
base.php Editor: Ensure global styles are rendered for third-party blocks. 2022-10-27 15:39:20 +00:00
customHeader.php Code Modernization: Explicitly declare all properties created in set_up() methods of various test classes. 2022-08-27 12:30:08 +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 Themes: Introduce wp_theme_has_theme_json() for public consumption. 2023-01-18 11:38:16 +00:00
wpAddGlobalStylesForBlocks.php Editor: Ensure global styles are rendered for third-party blocks. 2022-10-27 15:39:20 +00:00
wpGetGlobalStylesheet.php Editor: Backport block supports filter callback, registrations and tests to 6.1. 2022-09-19 20:54:20 +00:00
wpTheme.php Themes: Add support for Update URI header. 2022-08-23 17:46:46 +00:00
wpThemeGetAllowedFilters.php Tests: Use more appropriate assertions in various tests. 2021-07-07 10:32:56 +00:00
wpThemeHasThemeJson.php Themes: Introduce wp_theme_has_theme_json() for public consumption. 2023-01-18 11:38:16 +00:00
wpThemeJson.php Themes: Adds outline CSS properties support in theme.json. 2022-12-19 20:53:15 +00:00
wpThemeJsonResolver.php Themes: Introduce wp_theme_has_theme_json() for public consumption. 2023-01-18 11:38:16 +00:00
wpThemeJsonSchema.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2022-11-29 12:32:37 +00:00