Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#52451 new enhancement

Make the media sideload functions testable and add tests

Reported by: hellofromtonya's profile hellofromTonya Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Media Keywords:
Focuses: Cc:



  1. Make the media "sideload" functions testable
  2. Provide code coverage for these functions

To accomplish this:

  • These functions will first need to be refactored.
  • Then unit tests can be built to provide code coverage.

Sideload functions include:

  • media_handle_sideload()
  • media_sideload_image()

A guide for the refactoring work:

  • All changes will focus on testability
  • No changes should impact or alter the current behavior, extensibility, or backwards compatibility
  • Care will be given to maintainability and readability (i.e. code quality)

Change History (1)

#1 @hellofromTonya
3 years ago

For reference, the drivers for this ticket were discussed in #core-media slack (links below) initiated by Ticket #50972.

Links to slack discussions prior to opening this ticket:

  • Comments by @johnbillion

    Might be difficult for the same reason the new filter in media_sideload_image didn't get a test, those functions aren't very testable without refectoring

    The sideloading functions could all do with a refactor to make them testable

Note: See TracTickets for help on using tickets.