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

WordPress Trac noreply at wordpress.org
Thu Jul 22 00:29:13 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 jrf):

 `WP_Test_REST_Controller_Testcase::filter_rest_url_for_leading_slash()`
 would seem the most likely culprit.

 The function is added as a callback to a filter in the (parent)
 `WP_Test_REST_Controller_Testcase::setUp()` and the `rest_api_init` action
 is also called during `setUp()` - I still have to trace whether that
 causes the `filter_rest_url_for_leading_slash()` method to run, but seems
 likely, though that one filter callback being called four times during
 `setUp()` does feel like there may be an underlying bug in the REST API
 Controller logic anyway.

 While looking at this, I also noticed another issue with the `setUp()` and
 `tearDown()`: `setUp()` adds the `filter_rest_url_for_leading_slash()`
 method as a callback, but `tearDown()` tries to remove
 `test_rest_url_for_leading_slash()` as a callback.
 Not a real problem as the `WP_UnitTestCase_Base::tearDown()` calls
 `WP_UnitTestCase_Base::_restore_hooks()` which reset the hooks queue to
 its original state, but just thought I'd mention it as it does seem off.

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


More information about the wp-trac mailing list