wordpress-develop/tests/phpunit/tests/general
Felix Arntz ec21b604e0 Themes: Deprecate usage of TEMPLATEPATH and STYLESHEETPATH constants.
While generally the functions `get_template_directory()` and `get_stylesheet_directory()` were long recommended to use to get the parent or child theme directory, the `TEMPLATEPATH` and `STYLESHEETPATH` constants were still used in a few places in core, most importantly in template related logic.

The remaining usage was problematic as it prevented testability of certain key components of WordPress core.

This changeset replaces all remaining usage with the corresponding functions and effectively marks these constants as deprecated. It also adds test coverage accordingly and even unlocks some existing, previously commented out test coverage to work as expected.

Performance of the new approach has been benchmarked and shows no notable differences. Yet, given that the current theme directories are not expected to change within a regular WordPress page load, the `get_template_directory()` and `get_stylesheet_directory()` functions were amended with in-memory caching of the result, unless one of the defining values is being filtered.

Props thekt12, spacedmonkey, mukesh27, aaroncampbell, scribu, lloydbudd, cais, chipbennett, toscho, omarabid, CrazyJaco, DrewAPicture, obenland, wonderboymusic, nacin, helen, dd32, chriscct7, SergeyBiryukov, swissspidy, joemcgill, flixos90.
Fixes #18298.


git-svn-id: https://develop.svn.wordpress.org/trunk@56635 602fd350-edb4-49c9-b593-d223f7449a82
2023-09-20 17:25:26 +00:00
..
feedLinksExtra.php Coding Standards: Include one space after function keyword for closures. 2023-09-12 15:21:02 +00:00
paginateLinks.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
template_CheckedSelectedHelper.php Code Modernization: Rename the readonly() function to wp_readonly(). 2021-08-09 17:19:21 +00:00
template.php Themes: Deprecate usage of TEMPLATEPATH and STYLESHEETPATH constants. 2023-09-20 17:25:26 +00:00
wpError.php Build/Test Tools: Implement use of the void solution. 2021-08-07 10:29:41 +00:00
wpGetArchives.php Tests: Use the function get_num_queries across all unit tests. 2023-05-11 10:05:51 +00:00
wpGetDocumentTitle.php Tests: Use the factory method instead of the property. 2022-09-06 22:09:49 +00:00
wpPreloadResources.php Coding Standards: Remove superfluous blank lines at the end of various classes. 2023-09-08 09:30:38 +00:00
wpRequiredFieldIndicator.php Comments: Make wp_required_field_indicator() and wp_required_field_message() output filterable. 2022-09-12 22:29:02 +00:00
wpRequiredFieldMessage.php Comments: Make wp_required_field_indicator() and wp_required_field_message() output filterable. 2022-09-12 22:29:02 +00:00
wpResourceHints.php Coding Standards: Remove superfluous blank lines at the end of various functions. 2023-09-08 10:01:14 +00:00
wpTitle.php Template: Fix "undefined index: 00" when archive month query is empty in wp_title(). 2021-11-11 16:27:44 +00:00