#42298 closed enhancement (invalid)
Use wp_get_theme() and wp_get_themes() instead of deprecated get_theme(), get_themes() and get_current_theme() in Tests_Theme class.
Reported by: | birgire | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch |
Focuses: | Cc: |
Description
The Tests_Theme
test class uses deprecated functions get_theme()
, get_themes()
and get_current_theme()
with the annotations:
* @expectedDeprecated get_theme * @expectedDeprecated get_themes * @expectedDeprecated get_current_theme
I think we could update those with wp_get_theme()
and wp_get_themes()
instead and get rid of these extra annotations.
Attachments (1)
Change History (6)
#2
@
7 years ago
- Keywords has-patch added
42298.diff updates four test methods and removes the corresponding @expectedDeprecated annotations.
Excluded from this update is the test_extra_theme_headers()
method that uses the deprecated get_theme_data()
and corresponds to ticket #20897
#3
@
7 years ago
- Resolution set to invalid
- Status changed from new to closed
Thanks for the patch.
WordPress maintains existing test coverage for deprecated functions. These tests are meant to prevent any regressions that could break code still using deprecated APIs.
Removing the deprecated function usage in the tests would therefore reduce test coverage. Which is something that we would want to avoid.
#4
@
7 years ago
Thanks @Frank Klein
Reviewing this again I see that I've misread the purpose of those tests.
I read them as a general way to get the theme(s), instead of specific tests of the get_theme(s)
functions. Therefore I thought it made sense at the time to replace the deprecated functions.
So I absolutely agree with you here ;-)
Here's the corresponding test file:
https://core.trac.wordpress.org/browser/tags/4.8.2/tests/phpunit/tests/theme.php