[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 11:24:20 UTC 2020
#50366: WordPress rest_api_init action doesn't work in PHPUnit tests
-------------------------------+------------------------------
Reporter: skarabeq | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: 5.4.2
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by skarabeq):
@swissspidy, unfortunately, my repo is private and I can't share it with
you. But I found the problem. I have the registered route
{{{#!php
<?php
$news = new News;
register_rest_route('news/', 'posts',
[
[
'methods' => 'GET',
'callback' => [
$news,
'get_items'
],
],
'schema' => [
$news,
'data_schema'
]
]
}}}
I have removed the last slash chart and all PHPUnit tests work well. So
now it is:
{{{#!php
<?php
$news = new News;
register_rest_route('news', 'posts',
[
[
'methods' => 'GET',
'callback' => [
$news,
'get_items'
],
],
'schema' => [
$news,
'data_schema'
]
]
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50366#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list