WordPress.org

Make WordPress Core

Opened 22 months ago

Last modified 2 weeks ago

#42990 new enhancement

Deprecate WP_UnitTestCase::_make_attachment

Reported by: Frank Klein Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch needs-refresh
Focuses: Cc:
PR Number:

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 22 months ago.

Download all attachments as: .zip

Change History (4)

@Frank Klein
22 months ago

#1 @Frank Klein
22 months ago

  • Keywords has-patch added

#2 @pento
9 months ago

  • Version trunk deleted

#3 @desrosj
2 weeks 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.