Changeset 47253 for trunk/tests/phpunit/includes/spy-rest-server.php
- Timestamp:
- 02/11/2020 12:18:28 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/spy-rest-server.php
r46586 r47253 9 9 10 10 /** 11 * Get the raw $endpoints data from the server11 * Gets the raw $endpoints data from the server. 12 12 * 13 13 * @return array … … 18 18 19 19 /** 20 * Allow calling protected methods from tests 20 * Allow calling protected methods from tests. 21 21 * 22 * @param string $method Method to call 23 * @param array $args Arguments to pass to the method22 * @param string $method Method to call. 23 * @param array $args Arguments to pass to the method. 24 24 * @return mixed 25 25 */ … … 28 28 } 29 29 30 /** 31 * Adds a header to the list of sent headers. 32 * 33 * @param string $header Header name. 34 * @param string $value Header value. 35 */ 30 36 public function send_header( $header, $value ) { 31 37 $this->sent_headers[ $header ] = $value; 32 38 } 33 39 40 /** 41 * Removes a header from the list of sent headers. 42 * 43 * @param string $header Header name. 44 */ 34 45 public function remove_header( $header ) { 35 46 unset( $this->sent_headers[ $header ] ); … … 37 48 38 49 /** 39 * Override the dispatch method so we can get a handle on the request object.50 * Overrides the dispatch method so we can get a handle on the request object. 40 51 * 41 * @param WP_REST_Request $request 52 * @param WP_REST_Request $request Request to attempt dispatching. 42 53 * @return WP_REST_Response Response returned by the callback. 43 54 */ … … 48 59 49 60 /** 50 * Override the register_route method so we can re-register routes internally if needed.61 * Overrides the register_route method so we can re-register routes internally if needed. 51 62 * 52 63 * @param string $namespace Namespace. … … 54 65 * @param array $route_args Route arguments. 55 66 * @param bool $override Optional. Whether the route should be overridden if it already exists. 56 * Default false. Also set $GLOBALS['wp_rest_server']->override_by_default = true67 * Default false. Also set `$GLOBALS['wp_rest_server']->override_by_default = true` 57 68 * to set overrides when you don't have access to the caller context. 58 69 */ … … 61 72 } 62 73 74 /** 75 * Serves the request and returns the result. 76 * 77 * @param string $path Optional. The request route. If not set, `$_SERVER['PATH_INFO']` will be used. 78 * Default null. 79 * @return null|false Null if not served and a HEAD request, false otherwise. 80 */ 63 81 public function serve_request( $path = null ) { 64 82
Note: See TracChangeset
for help on using the changeset viewer.