[wp-trac] [WordPress Trac] #56248: Reduce code duplication in tests that upload file as attachment

WordPress Trac noreply at wordpress.org
Tue Jul 19 09:27:01 UTC 2022


#56248: Reduce code duplication in tests that upload file as attachment
--------------------------+------------------------------
 Reporter:  martin.krcho  |       Owner:  (none)
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  trunk
 Severity:  minor         |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------
Changes (by martin.krcho):

 * keywords:  needs-patch => has-patch


Comment:

 The attached
 [https://core.trac.wordpress.org/attachment/ticket/56248/56248.patch
 patch] introduces a new method
 `WP_UnitTestCase_Base::_upload_file_and_make_attachment()` that uploads
 given file and creates an attachment post from it.

 The patch also replaces all occurrences of the repetitive code - with the
 exception of few places where extra tests are ran to check the result of
 `wp_upload_bits()` call.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56248#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list