WordPress.org

Make WordPress Core

Opened 21 months ago

Closed 20 months ago

Last modified 20 months ago

#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)

42298.diff (3.2 KB) - added by birgire 21 months ago.

Download all attachments as: .zip

Change History (6)

@birgire
21 months ago

#2 @birgire
21 months 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

Last edited 21 months ago by birgire (previous) (diff)

#3 @Frank Klein
20 months 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 @birgire
20 months 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 ;-)

#5 @netweb
20 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.