mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
REST API: Introduce the rest_preload_api_request() function.
This function helps perform multiple REST API requests, for the purpose of preloading data into a page. Props pento. Merges [43763] to trunk. See #45110. git-svn-id: https://develop.svn.wordpress.org/trunk@44123 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -712,4 +712,13 @@ class Tests_REST_API extends WP_UnitTestCase {
|
||||
$routes = $GLOBALS['wp_rest_server']->get_routes();
|
||||
$this->assertEquals( $routes['/test-ns/test'][0]['methods'], array( 'GET' => true ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure rest_preload_api_request() works without notices in PHP 5.2.
|
||||
*
|
||||
* The array_reduce() function only accepts mixed variables starting with PHP 5.3.
|
||||
*/
|
||||
function test_rest_preload_api_request_no_notices_php_52() {
|
||||
$this->assertTrue( is_array( rest_preload_api_request( 0, '/' ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user