Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#34075 closed task (blessed) (fixed)

Consolidate methods for creating image attachments in tests

Reported by: joemcgill's profile joemcgill Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.4 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: needs-patch
Focuses: Cc:


In our test suite, we have three instances of a _make_attachment() helper function for uploading a file and creating an attachment for tests. They are in tests/image/intermediate_size.php, tests/post/attachment.php, and tests/ajax/MediaElement.php.

We should replace these helper functions with a new factory method inside WP_UnitTest_Factory_For_Attachment.

Change History (6)

#1 @boonebgorges
9 years ago

Or we could just have a globally-available tool - either a method on WP_UnitTestCase, or a utils function.

This ticket was mentioned in Slack in #core by joemcgill. View the logs.

9 years ago

#3 @wonderboymusic
9 years ago

  • Type changed from enhancement to task (blessed)

#4 @wonderboymusic
9 years ago

  • Owner set to wonderboymusic
  • Status changed from new to assigned

#5 follow-up: @wonderboymusic
9 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 35309:

Unit Tests: consolidate the many separate implementations of _make_attachment() into a helper method on WP_UnitTestCase.

Fixes #34075.

#6 in reply to: ↑ 5 @joemcgill
9 years ago

Replying to wonderboymusic:

Was planning to circle back to this. I added the same basic helper method as WP_UnitTest_Factory_For_Attachment:create_upload_object() in 34855.

Note: See TracTickets for help on using tickets.