[wp-trac] [WordPress Trac] #37630: WP_UnitTest_Factory_For_Attachment method for 'create' is not implemented

WordPress Trac noreply at wordpress.org
Tue Aug 23 13:27:21 UTC 2016


#37630: WP_UnitTest_Factory_For_Attachment method for 'create' is not implemented
------------------------------+---------------------------
 Reporter:  bcole808          |       Owner:  boonebgorges
     Type:  defect (bug)      |      Status:  assigned
 Priority:  normal            |   Milestone:  4.7
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  has-patch         |     Focuses:  docs
------------------------------+---------------------------
Changes (by boonebgorges):

 * keywords:  has-patch dev-feedback => has-patch
 * owner:   => boonebgorges
 * status:  new => assigned


Comment:

 Replying to [comment:6 bcole808]:
 > The params for filename and post parent ID are both optional for
 `wp_insert_attachment`, shouldn't we keep them optional for the factory as
 well instead of returning a WP Error in case they are missing?

 I believe that these params are optional only because it's possible to
 pass them in the `$args` array instead. If you don't provide a file and a
 parent, the post you create won't be a valid attachment, at least not for
 the purpose of doing unit testing. But I suppose there's no reason this
 has to be enforced by the factory - we can leave it up to people writing
 tests, if it's more consistent with `wp_insert_attachment()`.

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


More information about the wp-trac mailing list