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

WordPress Trac noreply at wordpress.org
Sat Jul 17 10:24:12 UTC 2021


#53363: Test tool and unit test improvements for 5.9
------------------------------+---------------------
 Reporter:  desrosj           |       Owner:  (none)
     Type:  task (blessed)    |      Status:  new
 Priority:  normal            |   Milestone:  5.9
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:                    |     Focuses:
------------------------------+---------------------

Comment (by SergeyBiryukov):

 In [changeset:"51450" 51450]:
 {{{
 #!CommitTicketReference repository="" revision="51450"
 Tests: Correct the test for autosaving a post with Ajax.

 `wp_autosave()` only updates drafts and auto-drafts created by the current
 user if the post is not locked.

 As a result of previous Ajax test refactoring, setting the current user
 and creating a test post ended up in different methods, with the user
 being set after the post is already created.

 This resulted in the test post being created with the `post_author` field
 set to zero, and the current user check in `wp_autosave()` failed. Instead
 of updating the original post as the test intended, it created a new
 autosave.

 The test only passed accidentally due to `assertGreaterThanOrEqual()` not
 performing a strict type check.

 Follow-up to [26995], [35311].

 See #53363.
 }}}

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


More information about the wp-trac mailing list