[wp-trac] [WordPress Trac] #55652: Test tool and unit test improvements for 6.1

WordPress Trac noreply at wordpress.org
Sun Oct 9 13:45:51 UTC 2022


#55652: Test tool and unit test improvements for 6.1
--------------------------------------+---------------------
 Reporter:  hellofromTonya            |       Owner:  (none)
     Type:  task (blessed)            |      Status:  new
 Priority:  normal                    |   Milestone:  6.1
Component:  Build/Test Tools          |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+---------------------

Comment (by SergeyBiryukov):

 In [changeset:"54424" 54424]:
 {{{
 #!CommitTicketReference repository="" revision="54424"
 Tests: Remove unnecessary file copying in `WP_Customize_Manager` tests.

 This was added to avoid creating leftover image sub-sizes in the version-
 controlled `DIR_TESTDATA` directory.

 However, this does not appear to be necessary:
 * `WP_Customizer_Manager::import_theme_starter_content()` already
 [source:tags/6.0.2/src/wp-includes/class-wp-customize-
 manager.php?marks=1370-1374#L1367 makes a copy of the image] before
 sideloading, so the test was essentially working with a copy of a copy.
 * The images were only used in one test out of 70 and do not need to be
 copied for every single test.

 Upon further investigation, there is also no evidence that creating these
 copies actually resolved the reported issue:
 * `WP_UnitTest_Factory_For_Attachment::create_object()` inserts an
 attachment, but does not create image sub-sizes.
 * `media_handle_sideload()` does create image sub-sizes, but the file is
 already in the media library by that time, and sub-sizes are created in
 the `uploads` directory, not in the version-controlled `DIR_TESTDATA`
 directory.

 This commit removes ~140 redundant file copying operations when running
 the test suite.

 Follow-up to [39276], [39346], [39411], [40142].

 See #55652.
 }}}

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


More information about the wp-trac mailing list