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

WordPress Trac noreply at wordpress.org
Fri Aug 19 16:42:35 UTC 2016


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

Comment (by boonebgorges):

 > Another possible solution could be to re-factor the Attachment factory
 so it uses the same method signature as it's parent class, but that would
 be more complex as tests currently rely on it as-is.

 This seems like the better strategy for internal consistency. However,
 we'll probably want to detect overloaded arguments for backward
 compatibility with third-party tools using the factory. So something like:

 {{{
 function create_object( $args, $legacy_parent = 0, $legacy_args = array()
 ) {
     if ( is_string( $args ) ) {
         $args = $legacy_args;
         $args['parent'] = $legacy_parent;
         $args['file'] = $args;
     }
 }
 }}}

 or something like that. (We could also do variadic `func_num_args()`
 magic, but it's harder to read.)

 What do you think?

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


More information about the wp-trac mailing list