Make WordPress Core

Opened 7 years ago

Last modified 5 years ago

#42990 new enhancement

Deprecate WP_UnitTestCase::_make_attachment

Reported by: frank-klein's profile Frank Klein Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch needs-refresh
Focuses: Cc:

Description

In r35309, several ways of creating an attachment for an uploaded media file were consolidated into a single method, WP_UnitTestCase::_make_attachment.

As part of r34855, a new method, create_upload_object, was added to WP_UnitTest_Factory_For_Attachment. It contains all of the code from _make_attachment, but additionally it also handles the upload of the media file.

We should deprecate the _make_attachment helper method, and use the factory method instead. This reduces duplicate code, and makes the interface of WP_UnitTestCase cleaner.

Attachments (1)

42990.patch (24.8 KB) - added by Frank Klein 7 years ago.

Download all attachments as: .zip

Change History (4)

@Frank Klein
7 years ago

#1 @Frank Klein
7 years ago

  • Keywords has-patch added

#2 @pento
6 years ago

  • Version trunk deleted

#3 @desrosj
5 years ago

  • Keywords needs-refresh added
  • Milestone changed from Awaiting Review to Future Release

Hi @frank-klein,

Thanks for this one! Sorry it took so long to receive a response.

Thinking this through, I think it would be best to ensure create_upload_object is used consistently in Core as a first step and then consider deprecating WP_UnitTestCase::_make_attachment.

I also just went to apply 42990.patch for testing, but it appears to need a refresh.

Note: See TracTickets for help on using tickets.