feat: add rest package endpoints

This commit is contained in:
Keith Solomon
2026-04-28 13:00:31 -05:00
parent 3c7ad655c0
commit e3d48f2383
3 changed files with 301 additions and 0 deletions
+28
View File
@@ -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.