feat: add rest package endpoints
This commit is contained in:
@@ -466,6 +466,34 @@ if ( ! function_exists( 'is_wp_error' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'register_rest_route' ) ) {
|
||||
/**
|
||||
* Minimal REST route registrar for unit tests.
|
||||
*
|
||||
* @param string $rest_namespace REST namespace.
|
||||
* @param string $route REST route.
|
||||
* @param array<string, mixed> $args Route arguments.
|
||||
* @return bool
|
||||
*/
|
||||
function register_rest_route( $rest_namespace, $route, array $args ) {
|
||||
$GLOBALS['wpcs_rest_routes'][ $rest_namespace . $route ] = $args;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'rest_ensure_response' ) ) {
|
||||
/**
|
||||
* Minimal REST response wrapper for unit tests.
|
||||
*
|
||||
* @param mixed $response Response value.
|
||||
* @return mixed
|
||||
*/
|
||||
function rest_ensure_response( $response ) {
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'admin_url' ) ) {
|
||||
/**
|
||||
* Minimal admin URL helper for unit tests.
|
||||
|
||||
Reference in New Issue
Block a user