mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 04:40:26 +00:00
REST API: Accept string path in rest_ensure_request.
Update `rest_ensure_request()` to accept a string path, permitting a string path to be passed to `rest_do_request()` as is indicated (previously inaccurately) in that method's PHPDoc. Props TimothyBlynJacobs, kadamwhite. Fixes #40614. git-svn-id: https://develop.svn.wordpress.org/trunk@46099 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -744,4 +744,14 @@ class Tests_REST_API extends WP_UnitTestCase {
|
||||
|
||||
$GLOBALS['wp_rest_server'] = $rest_server;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 40614
|
||||
*/
|
||||
function test_rest_ensure_response_accepts_path_string() {
|
||||
$request = rest_ensure_request( '/wp/v2/posts' );
|
||||
$this->assertInstanceOf( 'WP_REST_Request', $request );
|
||||
$this->assertEquals( '/wp/v2/posts', $request->get_route() );
|
||||
$this->assertEquals( 'GET', $request->get_method() );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user