[wp-trac] [WordPress Trac] #56203: Reduce code duplication in AJAX attachment handling tests

WordPress Trac noreply at wordpress.org
Tue Jul 12 12:44:27 UTC 2022


#56203: Reduce code duplication in AJAX attachment handling tests
--------------------------+-----------------------------
 Reporter:  martin.krcho  |      Owner:  (none)
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  trunk
 Severity:  minor         |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 The tests for AJAX attachment handling contain duplicated code to preform
 the following tasks.

 a) create a new admin user and set them as the current user
 https://github.com/WordPress/wordpress-
 develop/blob/6.0.0/tests/phpunit/tests/ajax/Attachments.php#L17-L27

 b) upload selected file and create an attachment
 https://github.com/WordPress/wordpress-
 develop/blob/6.0.0/tests/phpunit/tests/ajax/Attachments.php#L29-L33


 It would be great to replace the duplicated code with some helper
 functions. It would make creating more tests simpler.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56203>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list