[wp-trac] [WordPress Trac] #45265: REST API: register_rest_route should warn when used improperly.

WordPress Trac noreply at wordpress.org
Fri Jan 11 16:25:37 UTC 2019


#45265: REST API: register_rest_route should warn when used improperly.
--------------------------------------+------------------------
 Reporter:  kraftbj                   |       Owner:  desrosj
     Type:  defect (bug)              |      Status:  reviewing
 Priority:  normal                    |   Milestone:  5.1
Component:  REST API                  |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch needs-dev-note  |     Focuses:  rest-api
--------------------------------------+------------------------

Comment (by desrosj):

 In [attachment:"45265.4.diff"] I was able to fix the failing tests without
 using `@expectedIncorrectUsage`. Other REST API test classes manually
 `do_action( 'rest_api_init' )` in the `setUp()` method, but
 `Tests_REST_API` was not. Adding this fixes the failures.

 Also, `doing_action()` is not needed when `did_action()` is called. The
 action counter is incremented at the start of the action, so
 `did_action()` will be `true` at the same time `doing_action()` is true
 for the first time.

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


More information about the wp-trac mailing list