[wp-trac] [WordPress Trac] #63532: Unit Testing: Checking if images already exists before starting tests

WordPress Trac noreply at wordpress.org
Thu Jun 5 10:48:26 UTC 2025


#63532: Unit Testing: Checking if images already exists before starting tests
-------------------------------------------------+-------------------------
 Reporter:  SirLouen                             |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  6.9
Component:  Media                                |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-test-info has-patch has-unit-    |     Focuses:  tests
  tests                                          |
-------------------------------------------------+-------------------------
Changes (by SergeyBiryukov):

 * milestone:  Awaiting Review => 6.9


Comment:

 Hi there, thanks for the ticket!

 I think a safer approach would perhaps be to delete the pre-existing file,
 otherwise there might be a collision if a test expects an attachment with
 the same name but different data.

 Ideally, each test class should be responsible for deleting any leftover
 attachments, see [41693] / #38264.

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


More information about the wp-trac mailing list