WordPress.org

Make WordPress Core

Changeset 47253


Ignore:
Timestamp:
02/11/2020 12:18:28 AM (18 months ago)
Author:
SergeyBiryukov
Message:

Docs: Improve documentation for tests/phpunit/includes/spy-rest-server.php.

Props andizer.
Fixes #47567.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/spy-rest-server.php

    r46586 r47253  
    99
    1010    /**
    11      * Get the raw $endpoints data from the server
     11     * Gets the raw $endpoints data from the server.
    1212     *
    1313     * @return array
     
    1818
    1919    /**
    20      * Allow calling protected methods from tests
     20     * Allow calling protected methods from tests.
    2121     *
    22      * @param string $method Method to call
    23      * @param array $args Arguments to pass to the method
     22     * @param string $method Method to call.
     23     * @param array  $args   Arguments to pass to the method.
    2424     * @return mixed
    2525     */
     
    2828    }
    2929
     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     */
    3036    public function send_header( $header, $value ) {
    3137        $this->sent_headers[ $header ] = $value;
    3238    }
    3339
     40    /**
     41     * Removes a header from the list of sent headers.
     42     *
     43     * @param string $header Header name.
     44     */
    3445    public function remove_header( $header ) {
    3546        unset( $this->sent_headers[ $header ] );
     
    3748
    3849    /**
    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.
    4051     *
    41      * @param  WP_REST_Request $request
     52     * @param  WP_REST_Request $request Request to attempt dispatching.
    4253     * @return WP_REST_Response Response returned by the callback.
    4354     */
     
    4859
    4960    /**
    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.
    5162     *
    5263     * @param string $namespace  Namespace.
     
    5465     * @param array  $route_args Route arguments.
    5566     * @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 = true
     67     *                           Default false. Also set `$GLOBALS['wp_rest_server']->override_by_default = true`
    5768     *                           to set overrides when you don't have access to the caller context.
    5869     */
     
    6172    }
    6273
     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     */
    6381    public function serve_request( $path = null ) {
    6482
Note: See TracChangeset for help on using the changeset viewer.