[wp-trac] [WordPress Trac] #50366: WordPress rest_api_init action doesn't work in PHPUnit tests
WordPress Trac
noreply at wordpress.org
Thu Jun 11 14:14:56 UTC 2020
#50366: WordPress rest_api_init action doesn't work in PHPUnit tests
--------------------------+-------------------------
Reporter: skarabeq | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: REST API | Version: 5.4.2
Severity: normal | Resolution: worksforme
Keywords: | Focuses:
--------------------------+-------------------------
Comment (by skarabeq):
Replying to [comment:14 TimothyBlynJacobs]:
> @skarabeq you are receiving that message because you are running unit
tests. The test runner expects no incorrect usage notices to occur, but
one did occur for the `register_rest_route` function. The test runner
suppresses the normal error trigger so that it can be unit testable. If
you run your code outside of PHPUnit you'll see the full `_doing_it_wrong`
error.
Thank for the explanation, but for me, it is strange, different messages
for the same thing in a different environment. Anyway, for the future, I
will know what means that message {{{Unexpected incorrect usage notice for
register_rest_route}}}.
@ocean90, @swissspidy and @TimothyBlynJacobs thank you for support.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50366#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list