-
diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php
index 9d8752caea..d44fd05c4c 100644
|
|
|
function wp_ajax_upload_attachment() { |
| 2532 | 2532 | check_ajax_referer( 'media-form' ); |
| 2533 | 2533 | /* |
| 2534 | 2534 | * This function does not use wp_send_json_success() / wp_send_json_error() |
| 2535 | | * as the html4 Plupload handler requires a text/html content-type for older IE. |
| | 2535 | * as the html4 Plupload handler requires a text/html Content-Type for older IE. |
| 2536 | 2536 | * See https://core.trac.wordpress.org/ticket/31037 |
| 2537 | 2537 | */ |
| 2538 | 2538 | |
-
diff --git src/wp-admin/includes/file.php src/wp-admin/includes/file.php
index e8fb7a6951..b82d128b0d 100644
|
|
|
function download_url( $url, $timeout = 300, $signature_verification = false ) { |
| 1184 | 1184 | return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ), $data ); |
| 1185 | 1185 | } |
| 1186 | 1186 | |
| 1187 | | $content_disposition = wp_remote_retrieve_header( $response, 'content-disposition' ); |
| | 1187 | $content_disposition = wp_remote_retrieve_header( $response, 'Content-Disposition' ); |
| 1188 | 1188 | |
| 1189 | 1189 | if ( $content_disposition ) { |
| 1190 | 1190 | $content_disposition = strtolower( $content_disposition ); |
| … |
… |
function download_url( $url, $timeout = 300, $signature_verification = false ) { |
| 1211 | 1211 | } |
| 1212 | 1212 | } |
| 1213 | 1213 | |
| 1214 | | $content_md5 = wp_remote_retrieve_header( $response, 'content-md5' ); |
| | 1214 | $content_md5 = wp_remote_retrieve_header( $response, 'Content-MD5' ); |
| 1215 | 1215 | |
| 1216 | 1216 | if ( $content_md5 ) { |
| 1217 | 1217 | $md5_check = verify_file_md5( $tmpfname, $content_md5 ); |
| … |
… |
function download_url( $url, $timeout = 300, $signature_verification = false ) { |
| 1238 | 1238 | |
| 1239 | 1239 | // Perform signature valiation if supported. |
| 1240 | 1240 | if ( $signature_verification ) { |
| 1241 | | $signature = wp_remote_retrieve_header( $response, 'x-content-signature' ); |
| | 1241 | $signature = wp_remote_retrieve_header( $response, 'X-Content-Signature' ); |
| 1242 | 1242 | |
| 1243 | 1243 | if ( ! $signature ) { |
| 1244 | 1244 | // Retrieve signatures from a file if the header wasn't included. |
-
diff --git src/wp-admin/includes/upgrade.php src/wp-admin/includes/upgrade.php
index 5030483769..923455d82a 100644
|
|
|
function wp_install_maybe_enable_pretty_permalinks() { |
| 529 | 529 | * can block head requests. |
| 530 | 530 | */ |
| 531 | 531 | $response = wp_remote_get( $test_url, array( 'timeout' => 5 ) ); |
| 532 | | $x_pingback_header = wp_remote_retrieve_header( $response, 'x-pingback' ); |
| | 532 | $x_pingback_header = wp_remote_retrieve_header( $response, 'X-Pingback' ); |
| 533 | 533 | $pretty_permalinks = $x_pingback_header && get_bloginfo( 'pingback_url' ) === $x_pingback_header; |
| 534 | 534 | |
| 535 | 535 | if ( $pretty_permalinks ) { |
-
diff --git src/wp-includes/Requests/Transport/fsockopen.php src/wp-includes/Requests/Transport/fsockopen.php
index 56f94c99f2..fc9f6d2a52 100644
|
|
|
class Requests_Transport_fsockopen implements Requests_Transport { |
| 163 | 163 | $request_body = $data; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | | // Always include Content-length on POST requests to prevent |
| | 166 | // Always include Content-Length on POST requests to prevent |
| 167 | 167 | // 411 errors from some servers when the body is empty. |
| 168 | 168 | if (!empty($data) || $options['type'] === Requests::POST) { |
| 169 | 169 | if (!isset($case_insensitive_headers['Content-Length'])) { |
-
diff --git src/wp-includes/SimplePie/Misc.php src/wp-includes/SimplePie/Misc.php
index ce3cf0f546..e8a4fa5e1b 100644
|
|
|
class SimplePie_Misc |
| 2146 | 2146 | { |
| 2147 | 2147 | ob_start('ob_gzhandler'); |
| 2148 | 2148 | } |
| 2149 | | header('Content-type: text/javascript; charset: UTF-8'); |
| | 2149 | header('Content-Type: text/javascript; charset: UTF-8'); |
| 2150 | 2150 | header('Cache-Control: must-revalidate'); |
| 2151 | 2151 | header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days |
| 2152 | 2152 | ?> |
-
diff --git src/wp-includes/class-json.php src/wp-includes/class-json.php
index 9eca6f4b57..8e2cb7ca90 100644
|
|
|
class Services_JSON |
| 291 | 291 | { |
| 292 | 292 | _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); |
| 293 | 293 | |
| 294 | | header('Content-type: application/json'); |
| | 294 | header('Content-Type: application/json'); |
| 295 | 295 | return $this->encodeUnsafe($var); |
| 296 | 296 | } |
| 297 | 297 | /** |
-
diff --git src/wp-includes/class-simplepie.php src/wp-includes/class-simplepie.php
index a392e54cd9..3d639fc709 100644
|
|
|
class SimplePie |
| 1864 | 1864 | } |
| 1865 | 1865 | |
| 1866 | 1866 | /** |
| 1867 | | * Send the content-type header with correct encoding |
| | 1867 | * Send the Content-Type header with correct encoding |
| 1868 | 1868 | * |
| 1869 | 1869 | * This method ensures that the SimplePie-enabled page is being served with |
| 1870 | 1870 | * the correct {@link http://www.iana.org/assignments/media-types/ mime-type} |
| … |
… |
class SimplePie |
| 1886 | 1886 | { |
| 1887 | 1887 | if (!headers_sent()) |
| 1888 | 1888 | { |
| 1889 | | $header = "Content-type: $mime;"; |
| | 1889 | $header = "Content-Type: $mime;"; |
| 1890 | 1890 | if ($this->get_encoding()) |
| 1891 | 1891 | { |
| 1892 | 1892 | $header .= ' charset=' . $this->get_encoding(); |
-
diff --git src/wp-includes/class-snoopy.php src/wp-includes/class-snoopy.php
index fb6857c525..e82c673989 100644
|
|
|
class Snoopy |
| 53 | 53 | var $cookies = array(); // array of cookies to pass |
| 54 | 54 | // $cookies["username"]="joe"; |
| 55 | 55 | var $rawheaders = array(); // array of raw headers to send |
| 56 | | // $rawheaders["Content-type"]="text/html"; |
| | 56 | // $rawheaders["Content-Type"]="text/html"; |
| 57 | 57 | |
| 58 | 58 | var $maxredirs = 5; // http redirection depth maximum. 0 = disallow |
| 59 | 59 | var $lastredirectaddr = ""; // contains address of last redirected address |
| … |
… |
class Snoopy |
| 825 | 825 | $headers .= $headerKey.": ".$headerVal."\r\n"; |
| 826 | 826 | } |
| 827 | 827 | if(!empty($content_type)) { |
| 828 | | $headers .= "Content-type: $content_type"; |
| | 828 | $headers .= "Content-Type: $content_type"; |
| 829 | 829 | if ($content_type == "multipart/form-data") |
| 830 | 830 | $headers .= "; boundary=".$this->_mime_boundary; |
| 831 | 831 | $headers .= "\r\n"; |
| 832 | 832 | } |
| 833 | 833 | if(!empty($body)) |
| 834 | | $headers .= "Content-length: ".strlen($body)."\r\n"; |
| | 834 | $headers .= "Content-Length: ".strlen($body)."\r\n"; |
| 835 | 835 | if(!empty($this->user) || !empty($this->pass)) |
| 836 | 836 | $headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n"; |
| 837 | 837 | |
| … |
… |
class Snoopy |
| 990 | 990 | } |
| 991 | 991 | if(!empty($content_type)) { |
| 992 | 992 | if ($content_type == "multipart/form-data") |
| 993 | | $headers[] = "Content-type: $content_type; boundary=".$this->_mime_boundary; |
| | 993 | $headers[] = "Content-Type: $content_type; boundary=".$this->_mime_boundary; |
| 994 | 994 | else |
| 995 | | $headers[] = "Content-type: $content_type"; |
| | 995 | $headers[] = "Content-Type: $content_type"; |
| 996 | 996 | } |
| 997 | 997 | if(!empty($body)) |
| 998 | | $headers[] = "Content-length: ".strlen($body); |
| | 998 | $headers[] = "Content-Length: ".strlen($body); |
| 999 | 999 | if(!empty($this->user) || !empty($this->pass)) |
| 1000 | 1000 | $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass); |
| 1001 | 1001 | |
-
diff --git src/wp-includes/comment.php src/wp-includes/comment.php
index 4777b91dff..ddf3f208fa 100644
|
|
|
function discover_pingback_server_uri( $url, $deprecated = '' ) { |
| 2802 | 2802 | return false; |
| 2803 | 2803 | } |
| 2804 | 2804 | |
| 2805 | | if ( wp_remote_retrieve_header( $response, 'x-pingback' ) ) { |
| 2806 | | return wp_remote_retrieve_header( $response, 'x-pingback' ); |
| | 2805 | if ( wp_remote_retrieve_header( $response, 'X-Pingback' ) ) { |
| | 2806 | return wp_remote_retrieve_header( $response, 'X-Pingback' ); |
| 2807 | 2807 | } |
| 2808 | 2808 | |
| 2809 | 2809 | // Not an (x)html, sgml, or xml page, no use going further. |
| 2810 | | if ( preg_match( '#(image|audio|video|model)/#is', wp_remote_retrieve_header( $response, 'content-type' ) ) ) { |
| | 2810 | if ( preg_match( '#(image|audio|video|model)/#is', wp_remote_retrieve_header( $response, 'Content-Type' ) ) ) { |
| 2811 | 2811 | return false; |
| 2812 | 2812 | } |
| 2813 | 2813 | |
-
diff --git src/wp-includes/functions.php src/wp-includes/functions.php
index 946853c361..ab7eb60a77 100644
|
|
|
function do_enclose( $content, $post ) { |
| 945 | 945 | |
| 946 | 946 | $headers = wp_get_http_headers( $url ); |
| 947 | 947 | if ( $headers ) { |
| 948 | | $len = isset( $headers['content-length'] ) ? (int) $headers['content-length'] : 0; |
| 949 | | $type = isset( $headers['content-type'] ) ? $headers['content-type'] : ''; |
| | 948 | $len = isset( $headers['Content-Length'] ) ? (int) $headers['Content-Length'] : 0; |
| | 949 | $type = isset( $headers['Content-Type'] ) ? $headers['Content-Type'] : ''; |
| 950 | 950 | $allowed_types = array( 'video', 'audio' ); |
| 951 | 951 | |
| 952 | 952 | // Check to see if we can figure out the mime type from the extension. |
| … |
… |
function do_enclose( $content, $post ) { |
| 978 | 978 | * |
| 979 | 979 | * @param string $url URL to retrieve HTTP headers from. |
| 980 | 980 | * @param bool $deprecated Not Used. |
| 981 | | * @return string|false Headers on success, false on failure. |
| | 981 | * @return false|Requests_Utility_CaseInsensitiveDictionary Headers on success, false on failure. |
| 982 | 982 | */ |
| 983 | 983 | function wp_get_http_headers( $url, $deprecated = false ) { |
| 984 | 984 | if ( ! empty( $deprecated ) ) { |
-
diff --git src/wp-includes/general-template.php src/wp-includes/general-template.php
index 1a23cb4316..644513ad2b 100644
|
|
|
function bloginfo( $show = '' ) { |
| 755 | 755 | * - 'admin_email' - Admin email (set in Settings > General) |
| 756 | 756 | * - 'charset' - The "Encoding for pages and feeds" (set in Settings > Reading) |
| 757 | 757 | * - 'version' - The current WordPress version |
| 758 | | * - 'html_type' - The content-type (default: "text/html"). Themes and plugins |
| | 758 | * - 'html_type' - The Content-Type (default: "text/html"). Themes and plugins |
| 759 | 759 | * can override the default value using the {@see 'pre_option_html_type'} filter |
| 760 | 760 | * - 'text_direction' - The text direction determined by the site's language. is_rtl() |
| 761 | 761 | * should be used instead |
-
diff --git src/wp-includes/pluggable.php src/wp-includes/pluggable.php
index 5ab3eef749..8bdf747aa6 100644
|
|
|
if ( ! function_exists( 'wp_mail' ) ) : |
| 468 | 468 | |
| 469 | 469 | // Set Content-Type and charset. |
| 470 | 470 | |
| 471 | | // If we don't have a content-type from the input headers. |
| | 471 | // If we don't have a Content-Type from the input headers. |
| 472 | 472 | if ( ! isset( $content_type ) ) { |
| 473 | 473 | $content_type = 'text/plain'; |
| 474 | 474 | } |
-
diff --git src/wp-includes/rest-api/class-wp-rest-request.php src/wp-includes/rest-api/class-wp-rest-request.php
index b93bd36857..1d48c3f70c 100644
|
|
|
class WP_REST_Request implements ArrayAccess { |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
| 294 | | * Retrieves the content-type of the request. |
| | 294 | * Retrieves the Content-Type of the request. |
| 295 | 295 | * |
| 296 | 296 | * @since 4.4.0 |
| 297 | 297 | * |
| 298 | 298 | * @return array|null Map containing 'value' and 'parameters' keys |
| 299 | | * or null when no valid content-type header was |
| | 299 | * or null when no valid Content-Type header was |
| 300 | 300 | * available. |
| 301 | 301 | */ |
| 302 | 302 | public function get_content_type() { |
| 303 | | $value = $this->get_header( 'content-type' ); |
| | 303 | $value = $this->get_header( 'Content-Type' ); |
| 304 | 304 | if ( empty( $value ) ) { |
| 305 | 305 | return null; |
| 306 | 306 | } |
| … |
… |
class WP_REST_Request implements ArrayAccess { |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /** |
| 328 | | * Checks if the request has specified a JSON content-type. |
| | 328 | * Checks if the request has specified a JSON Content-Type. |
| 329 | 329 | * |
| 330 | 330 | * @since 5.6.0 |
| 331 | 331 | * |
| 332 | | * @return bool True if the content-type header is JSON. |
| | 332 | * @return bool True if the Content-Type header is JSON. |
| 333 | 333 | */ |
| 334 | 334 | public function is_json_content_type() { |
| 335 | 335 | $content_type = $this->get_content_type(); |
| … |
… |
class WP_REST_Request implements ArrayAccess { |
| 719 | 719 | $this->parsed_body = true; |
| 720 | 720 | |
| 721 | 721 | /* |
| 722 | | * Check that we got URL-encoded. Treat a missing content-type as |
| | 722 | * Check that we got URL-encoded. Treat a missing Content-Type as |
| 723 | 723 | * URL-encoded for maximum compatibility. |
| 724 | 724 | */ |
| 725 | 725 | $content_type = $this->get_content_type(); |
-
diff --git src/wp-includes/sitemaps/class-wp-sitemaps-renderer.php src/wp-includes/sitemaps/class-wp-sitemaps-renderer.php
index 11d5c3820a..9f91a10b7c 100644
|
|
|
class WP_Sitemaps_Renderer { |
| 123 | 123 | * @param array $sitemaps Array of sitemap URLs. |
| 124 | 124 | */ |
| 125 | 125 | public function render_index( $sitemaps ) { |
| 126 | | header( 'Content-type: application/xml; charset=UTF-8' ); |
| | 126 | header( 'Content-Type: application/xml; charset=UTF-8' ); |
| 127 | 127 | |
| 128 | 128 | $this->check_for_simple_xml_availability(); |
| 129 | 129 | |
| … |
… |
class WP_Sitemaps_Renderer { |
| 188 | 188 | * @param array $url_list Array of URLs for a sitemap. |
| 189 | 189 | */ |
| 190 | 190 | public function render_sitemap( $url_list ) { |
| 191 | | header( 'Content-type: application/xml; charset=UTF-8' ); |
| | 191 | header( 'Content-Type: application/xml; charset=UTF-8' ); |
| 192 | 192 | |
| 193 | 193 | $this->check_for_simple_xml_availability(); |
| 194 | 194 | |
-
diff --git src/wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php src/wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php
index 8268fcc924..f752a7f55f 100644
|
|
|
class WP_Sitemaps_Stylesheet { |
| 22 | 22 | * @param string $type Stylesheet type. Either 'sitemap' or 'index'. |
| 23 | 23 | */ |
| 24 | 24 | public function render_stylesheet( $type ) { |
| 25 | | header( 'Content-type: application/xml; charset=UTF-8' ); |
| | 25 | header( 'Content-Type: application/xml; charset=UTF-8' ); |
| 26 | 26 | |
| 27 | 27 | if ( 'sitemap' === $type ) { |
| 28 | 28 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- All content escaped below. |
-
diff --git src/wp-mail.php src/wp-mail.php
index d3a86352f2..ddc8874e84 100644
|
|
|
for ( $i = 1; $i <= $count; $i++ ) { |
| 170 | 170 | $content = explode( '--' . $boundary, $content ); |
| 171 | 171 | $content = $content[2]; |
| 172 | 172 | |
| 173 | | // Match case-insensitive content-transfer-encoding. |
| | 173 | // Match case-insensitive Content-Transfer-Encoding. |
| 174 | 174 | if ( preg_match( '/Content-Transfer-Encoding: quoted-printable/i', $content, $delim ) ) { |
| 175 | 175 | $content = explode( $delim[0], $content ); |
| 176 | 176 | $content = $content[1]; |
-
diff --git tests/phpunit/data/WPHTTP-testcase-redirection-script.php tests/phpunit/data/WPHTTP-testcase-redirection-script.php
index a73e8c6e09..94643d3de9 100644
|
|
|
if ( isset($_GET['201-location']) ) { |
| 36 | 36 | } |
| 37 | 37 | if ( isset($_GET['header-check']) ) { |
| 38 | 38 | $out = array(); |
| 39 | | header("Content-type: text/plain"); |
| | 39 | header("Content-Type: text/plain"); |
| 40 | 40 | foreach ( $_SERVER as $key => $value ) { |
| 41 | 41 | if ( stripos($key, 'http') === 0 ) { |
| 42 | 42 | $key = strtolower(substr($key, 5)); |
| … |
… |
if ( isset( $_GET['post-redirect-to-method'] ) ) { |
| 63 | 63 | |
| 64 | 64 | echo $method; |
| 65 | 65 | exit; |
| 66 | | |
| | 66 | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | if ( isset( $_GET['location-with-200'] ) ) { |
-
diff --git tests/phpunit/tests/admin/includesFile.php tests/phpunit/tests/admin/includesFile.php
index b598a2d3bd..38d66e8354 100644
|
|
|
class Tests_Admin_IncludesFile extends WP_UnitTestCase { |
| 156 | 156 | 'code' => 200, |
| 157 | 157 | ), |
| 158 | 158 | 'headers' => array( |
| 159 | | 'content-disposition' => 'attachment; filename="filename-from-content-disposition-header.txt"', |
| | 159 | 'Content-Disposition' => 'attachment; filename="filename-from-content-disposition-header.txt"', |
| 160 | 160 | ), |
| 161 | 161 | ); |
| 162 | 162 | } |
| … |
… |
class Tests_Admin_IncludesFile extends WP_UnitTestCase { |
| 174 | 174 | 'code' => 200, |
| 175 | 175 | ), |
| 176 | 176 | 'headers' => array( |
| 177 | | 'content-disposition' => 'attachment; filename="../../filename-from-content-disposition-header.txt"', |
| | 177 | 'Content-Disposition' => 'attachment; filename="../../filename-from-content-disposition-header.txt"', |
| 178 | 178 | ), |
| 179 | 179 | ); |
| 180 | 180 | } |
| … |
… |
class Tests_Admin_IncludesFile extends WP_UnitTestCase { |
| 192 | 192 | 'code' => 200, |
| 193 | 193 | ), |
| 194 | 194 | 'headers' => array( |
| 195 | | 'content-disposition' => 'attachment; filename=filename-from-content-disposition-header.txt', |
| | 195 | 'Content-Disposition' => 'attachment; filename=filename-from-content-disposition-header.txt', |
| 196 | 196 | ), |
| 197 | 197 | ); |
| 198 | 198 | } |
| … |
… |
class Tests_Admin_IncludesFile extends WP_UnitTestCase { |
| 241 | 241 | 'code' => 200, |
| 242 | 242 | ), |
| 243 | 243 | 'headers' => array( |
| 244 | | 'content-disposition' => 'filename="filename-from-content-disposition-header.txt"', |
| | 244 | 'Content-Disposition' => 'filename="filename-from-content-disposition-header.txt"', |
| 245 | 245 | ), |
| 246 | 246 | ); |
| 247 | 247 | } |
| … |
… |
class Tests_Admin_IncludesFile extends WP_UnitTestCase { |
| 259 | 259 | 'code' => 200, |
| 260 | 260 | ), |
| 261 | 261 | 'headers' => array( |
| 262 | | 'content-disposition' => 'inline; filename="filename-from-content-disposition-header.txt"', |
| | 262 | 'Content-Disposition' => 'inline; filename="filename-from-content-disposition-header.txt"', |
| 263 | 263 | ), |
| 264 | 264 | ); |
| 265 | 265 | } |
| … |
… |
class Tests_Admin_IncludesFile extends WP_UnitTestCase { |
| 277 | 277 | 'code' => 200, |
| 278 | 278 | ), |
| 279 | 279 | 'headers' => array( |
| 280 | | 'content-disposition' => 'form-data; name="file"; filename="filename-from-content-disposition-header.txt"', |
| | 280 | 'Content-Disposition' => 'form-data; name="file"; filename="filename-from-content-disposition-header.txt"', |
| 281 | 281 | ), |
| 282 | 282 | ); |
| 283 | 283 | } |
-
diff --git tests/phpunit/tests/functions/doEnclose.php tests/phpunit/tests/functions/doEnclose.php
index 6c06f35182..71d96edbac 100644
|
|
|
class Tests_Functions_DoEnclose extends WP_UnitTestCase { |
| 265 | 265 | $fake_headers = array( |
| 266 | 266 | 'mp4' => array( |
| 267 | 267 | 'headers' => array( |
| 268 | | 'content-length' => 123, |
| 269 | | 'content-type' => 'video/mp4', |
| | 268 | 'Content-Length' => 123, |
| | 269 | 'Content-Type' => 'video/mp4', |
| 270 | 270 | ), |
| 271 | 271 | ), |
| 272 | 272 | 'ogg' => array( |
| 273 | 273 | 'headers' => array( |
| 274 | | 'content-length' => 321, |
| 275 | | 'content-type' => 'audio/ogg', |
| | 274 | 'Content-Length' => 321, |
| | 275 | 'Content-Type' => 'audio/ogg', |
| 276 | 276 | ), |
| 277 | 277 | ), |
| 278 | 278 | ); |
| … |
… |
class Tests_Functions_DoEnclose extends WP_UnitTestCase { |
| 289 | 289 | // Fallback header. |
| 290 | 290 | return array( |
| 291 | 291 | 'headers' => array( |
| 292 | | 'content-length' => 0, |
| 293 | | 'content-type' => '', |
| | 292 | 'Content-Length' => 0, |
| | 293 | 'Content-Type' => '', |
| 294 | 294 | ), |
| 295 | 295 | ); |
| 296 | 296 | } |
-
diff --git tests/phpunit/tests/http/base.php tests/phpunit/tests/http/base.php
index ee42056bb3..9d64f572a8 100644
|
|
|
abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase { |
| 283 | 283 | $this->skipTestOnTimeout( $res ); |
| 284 | 284 | $this->assertNotWPError( $res ); |
| 285 | 285 | $this->assertSame( '', $res['body'] ); // The body should be empty. |
| 286 | | $this->assertEquals( $size, $res['headers']['content-length'] ); // Check the headers are returned (and the size is the same). |
| | 286 | $this->assertEquals( $size, $res['headers']['Content-Length'] ); // Check the headers are returned (and the size is the same). |
| 287 | 287 | $this->assertSame( $size, $filesize ); // Check that the file is written to disk correctly without any extra characters. |
| 288 | 288 | $this->assertStringStartsWith( get_temp_dir(), $res['filename'] ); // Check it's saving within the temp directory. |
| 289 | 289 | } |
| … |
… |
abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase { |
| 450 | 450 | $res = wp_remote_head( $url, array( 'timeout' => 30 ) ); |
| 451 | 451 | |
| 452 | 452 | $this->skipTestOnTimeout( $res ); |
| 453 | | $this->assertIsArray( wp_remote_retrieve_header( $res, 'location' ) ); |
| 454 | | $this->assertCount( 2, wp_remote_retrieve_header( $res, 'location' ) ); |
| | 453 | $this->assertIsArray( wp_remote_retrieve_header( $res, 'Location' ) ); |
| | 454 | $this->assertCount( 2, wp_remote_retrieve_header( $res, 'Location' ) ); |
| 455 | 455 | |
| 456 | 456 | $res = wp_remote_get( $url, array( 'timeout' => 30 ) ); |
| 457 | 457 | |
-
diff --git tests/phpunit/tests/http/functions.php tests/phpunit/tests/http/functions.php
index 49854e0053..40e51cb071 100644
|
|
|
class Tests_HTTP_Functions extends WP_UnitTestCase { |
| 20 | 20 | |
| 21 | 21 | $this->assertIsArray( $response ); |
| 22 | 22 | |
| 23 | | $this->assertSame( 'image/jpeg', $headers['content-type'] ); |
| 24 | | $this->assertSame( '40148', $headers['content-length'] ); |
| | 23 | $this->assertSame( 'image/jpeg', $headers['Content-Type'] ); |
| | 24 | $this->assertSame( '40148', $headers['Content-Length'] ); |
| 25 | 25 | $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) ); |
| 26 | 26 | } |
| 27 | 27 | |
| … |
… |
class Tests_HTTP_Functions extends WP_UnitTestCase { |
| 65 | 65 | $this->assertIsArray( $response ); |
| 66 | 66 | |
| 67 | 67 | // Should return the same headers as a HEAD request. |
| 68 | | $this->assertSame( 'image/jpeg', $headers['content-type'] ); |
| 69 | | $this->assertSame( '40148', $headers['content-length'] ); |
| | 68 | $this->assertSame( 'image/jpeg', $headers['Content-Type'] ); |
| | 69 | $this->assertSame( '40148', $headers['Content-Length'] ); |
| 70 | 70 | $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) ); |
| 71 | 71 | } |
| 72 | 72 | |
| … |
… |
class Tests_HTTP_Functions extends WP_UnitTestCase { |
| 86 | 86 | $headers = wp_remote_retrieve_headers( $response ); |
| 87 | 87 | |
| 88 | 88 | // Should return the same headers as a HEAD request. |
| 89 | | $this->assertSame( 'image/jpeg', $headers['content-type'] ); |
| 90 | | $this->assertSame( '40148', $headers['content-length'] ); |
| | 89 | $this->assertSame( 'image/jpeg', $headers['Content-Type'] ); |
| | 90 | $this->assertSame( '40148', $headers['Content-Length'] ); |
| 91 | 91 | $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) ); |
| 92 | 92 | } |
| 93 | 93 | |
-
diff --git tests/phpunit/tests/post/wpAfterInsertPost.php tests/phpunit/tests/post/wpAfterInsertPost.php
index c81ad21387..f184c66e01 100644
|
|
|
class Tests_Post_wpAfterInsertPost extends WP_UnitTestCase { |
| 171 | 171 | $post_id = self::$post_id; |
| 172 | 172 | |
| 173 | 173 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', $post_id ) ); |
| 174 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 174 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 175 | 175 | $request->set_body_params( array( 'title' => 'new title' ) ); |
| 176 | 176 | rest_get_server()->dispatch( $request ); |
| 177 | 177 | |
| … |
… |
class Tests_Post_wpAfterInsertPost extends WP_UnitTestCase { |
| 188 | 188 | wp_set_current_user( self::$admin_id ); |
| 189 | 189 | |
| 190 | 190 | $request = new WP_REST_Request( 'POST', sprintf( '/wp/v2/posts' ) ); |
| 191 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 191 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 192 | 192 | $request->set_body_params( |
| 193 | 193 | array( |
| 194 | 194 | 'title' => 'new title', |
| … |
… |
class Tests_Post_wpAfterInsertPost extends WP_UnitTestCase { |
| 211 | 211 | $attachment_id = self::$attachment_id; |
| 212 | 212 | |
| 213 | 213 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/media/%d', $attachment_id ) ); |
| 214 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 214 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 215 | 215 | $request->set_body_params( array( 'title' => 'new attachment title' ) ); |
| 216 | 216 | rest_get_server()->dispatch( $request ); |
| 217 | 217 | |
-
diff --git tests/phpunit/tests/rest-api/rest-autosaves-controller.php tests/phpunit/tests/rest-api/rest-autosaves-controller.php
index 2a7eacb8b9..4d9ca15531 100644
|
|
|
class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle |
| 311 | 311 | wp_set_current_user( self::$editor_id ); |
| 312 | 312 | |
| 313 | 313 | $request = new WP_REST_Request( 'POST', '/wp/v2/posts/' . self::$post_id . '/autosaves' ); |
| 314 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 314 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 315 | 315 | |
| 316 | 316 | $params = $this->set_post_data( |
| 317 | 317 | array( |
| … |
… |
class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle |
| 327 | 327 | public function test_update_item() { |
| 328 | 328 | wp_set_current_user( self::$editor_id ); |
| 329 | 329 | $request = new WP_REST_Request( 'POST', '/wp/v2/posts/' . self::$post_id . '/autosaves' ); |
| 330 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 330 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 331 | 331 | |
| 332 | 332 | $params = $this->set_post_data( |
| 333 | 333 | array( |
| … |
… |
class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle |
| 346 | 346 | wp_set_current_user( self::$contributor_id ); |
| 347 | 347 | |
| 348 | 348 | $request = new WP_REST_Request( 'POST', '/wp/v2/posts/' . self::$post_id . '/autosaves' ); |
| 349 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 349 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 350 | 350 | |
| 351 | 351 | $params = $this->set_post_data( |
| 352 | 352 | array( |
| … |
… |
class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle |
| 365 | 365 | wp_set_current_user( self::$editor_id ); |
| 366 | 366 | |
| 367 | 367 | $request = new WP_REST_Request( 'POST', '/wp/v2/posts/' . self::$post_id . '/autosaves' ); |
| 368 | | $request->add_header( 'content-type', 'application/json' ); |
| | 368 | $request->add_header( 'Content-Type', 'application/json' ); |
| 369 | 369 | |
| 370 | 370 | $current_post = get_post( self::$post_id ); |
| 371 | 371 | |
| … |
… |
class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle |
| 412 | 412 | ); |
| 413 | 413 | |
| 414 | 414 | $request = new WP_REST_Request( 'POST', '/wp/v2/posts/' . self::$post_id . '/autosaves' ); |
| 415 | | $request->add_header( 'content-type', 'application/json' ); |
| | 415 | $request->add_header( 'Content-Type', 'application/json' ); |
| 416 | 416 | $request->set_body( wp_json_encode( $autosave_data ) ); |
| 417 | 417 | |
| 418 | 418 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle |
| 451 | 451 | ); |
| 452 | 452 | |
| 453 | 453 | $request = new WP_REST_Request( 'POST', '/wp/v2/posts/' . self::$post_id . '/autosaves' ); |
| 454 | | $request->add_header( 'content-type', 'application/json' ); |
| | 454 | $request->add_header( 'Content-Type', 'application/json' ); |
| 455 | 455 | $request->set_body( wp_json_encode( $autosave_data ) ); |
| 456 | 456 | |
| 457 | 457 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle |
| 572 | 572 | public function test_update_item_draft_page_with_parent() { |
| 573 | 573 | wp_set_current_user( self::$editor_id ); |
| 574 | 574 | $request = new WP_REST_Request( 'POST', '/wp/v2/pages/' . self::$child_draft_page_id . '/autosaves' ); |
| 575 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 575 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 576 | 576 | |
| 577 | 577 | $params = $this->set_post_data( |
| 578 | 578 | array( |
| … |
… |
class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle |
| 593 | 593 | wp_set_current_user( self::$editor_id ); |
| 594 | 594 | |
| 595 | 595 | $request = new WP_REST_Request( 'POST', '/wp/v2/pages/' . self::$draft_page_id . '/autosaves' ); |
| 596 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 596 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 597 | 597 | |
| 598 | 598 | $params = $this->set_post_data( |
| 599 | 599 | array( |
| … |
… |
class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle |
| 648 | 648 | |
| 649 | 649 | // Initiate an autosave via the REST API as Gutenberg does. |
| 650 | 650 | $request = new WP_REST_Request( 'POST', '/wp/v2/posts/' . self::$post_id . '/autosaves' ); |
| 651 | | $request->add_header( 'content-type', 'application/json' ); |
| | 651 | $request->add_header( 'Content-Type', 'application/json' ); |
| 652 | 652 | $request->set_body( wp_json_encode( $autosave_data ) ); |
| 653 | 653 | |
| 654 | 654 | $response = rest_get_server()->dispatch( $request ); |
-
diff --git tests/phpunit/tests/rest-api/rest-block-renderer-controller.php tests/phpunit/tests/rest-api/rest-block-renderer-controller.php
index 9f2401e893..7f7b468fe4 100644
|
|
|
class REST_Block_Renderer_Controller_Test extends WP_Test_REST_Controller_Testca |
| 501 | 501 | $attributes = array( 'some_string' => $string_attribute ); |
| 502 | 502 | $request = new WP_REST_Request( 'POST', self::$rest_api_route . self::$block_name ); |
| 503 | 503 | $request->set_param( 'context', 'edit' ); |
| 504 | | $request->set_header( 'content-type', 'application/json' ); |
| | 504 | $request->set_header( 'Content-Type', 'application/json' ); |
| 505 | 505 | $request->set_body( wp_json_encode( compact( 'attributes' ) ) ); |
| 506 | 506 | $response = rest_get_server()->dispatch( $request ); |
| 507 | 507 | |
-
diff --git tests/phpunit/tests/rest-api/rest-comments-controller.php tests/phpunit/tests/rest-api/rest-comments-controller.php
index eb66ee5d41..0c3b27410c 100644
|
|
|
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1133 | 1133 | ); |
| 1134 | 1134 | |
| 1135 | 1135 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1136 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1136 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1137 | 1137 | $request->set_body( wp_json_encode( $params ) ); |
| 1138 | 1138 | |
| 1139 | 1139 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1239 | 1239 | ); |
| 1240 | 1240 | |
| 1241 | 1241 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1242 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1242 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1243 | 1243 | $request->set_body( wp_json_encode( $params ) ); |
| 1244 | 1244 | |
| 1245 | 1245 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1264 | 1264 | ); |
| 1265 | 1265 | |
| 1266 | 1266 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1267 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1267 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1268 | 1268 | $request->set_body( wp_json_encode( $params ) ); |
| 1269 | 1269 | |
| 1270 | 1270 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1287 | 1287 | ); |
| 1288 | 1288 | |
| 1289 | 1289 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1290 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1290 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1291 | 1291 | $request->set_body( wp_json_encode( $params ) ); |
| 1292 | 1292 | |
| 1293 | 1293 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1307 | 1307 | ); |
| 1308 | 1308 | |
| 1309 | 1309 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1310 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1310 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1311 | 1311 | $request->set_body( wp_json_encode( $params ) ); |
| 1312 | 1312 | |
| 1313 | 1313 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1327 | 1327 | ); |
| 1328 | 1328 | |
| 1329 | 1329 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1330 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1330 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1331 | 1331 | $request->set_body( wp_json_encode( $params ) ); |
| 1332 | 1332 | |
| 1333 | 1333 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1347 | 1347 | ); |
| 1348 | 1348 | |
| 1349 | 1349 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1350 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1350 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1351 | 1351 | $request->set_body( wp_json_encode( $params ) ); |
| 1352 | 1352 | |
| 1353 | 1353 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1365 | 1365 | ); |
| 1366 | 1366 | |
| 1367 | 1367 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1368 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1368 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1369 | 1369 | $request->set_body( wp_json_encode( $params ) ); |
| 1370 | 1370 | $response = rest_get_server()->dispatch( $request ); |
| 1371 | 1371 | |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1386 | 1386 | ); |
| 1387 | 1387 | |
| 1388 | 1388 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1389 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1389 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1390 | 1390 | $request->set_body( wp_json_encode( $params ) ); |
| 1391 | 1391 | |
| 1392 | 1392 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1413 | 1413 | ); |
| 1414 | 1414 | |
| 1415 | 1415 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1416 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1416 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1417 | 1417 | $request->set_body( wp_json_encode( $params ) ); |
| 1418 | 1418 | |
| 1419 | 1419 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1435 | 1435 | ); |
| 1436 | 1436 | |
| 1437 | 1437 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1438 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1438 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1439 | 1439 | $request->set_body( wp_json_encode( $params ) ); |
| 1440 | 1440 | |
| 1441 | 1441 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1460 | 1460 | ); |
| 1461 | 1461 | |
| 1462 | 1462 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1463 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1463 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1464 | 1464 | $request->set_body( wp_json_encode( $params ) ); |
| 1465 | 1465 | |
| 1466 | 1466 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1481 | 1481 | ); |
| 1482 | 1482 | |
| 1483 | 1483 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1484 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1484 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1485 | 1485 | $request->set_body( wp_json_encode( $params ) ); |
| 1486 | 1486 | |
| 1487 | 1487 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1510 | 1510 | ); |
| 1511 | 1511 | |
| 1512 | 1512 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1513 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1513 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1514 | 1514 | $request->set_body( wp_json_encode( $params ) ); |
| 1515 | 1515 | $response = rest_get_server()->dispatch( $request ); |
| 1516 | 1516 | $this->assertSame( 201, $response->get_status() ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1536 | 1536 | ); |
| 1537 | 1537 | |
| 1538 | 1538 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1539 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1539 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1540 | 1540 | $request->set_body( wp_json_encode( $params ) ); |
| 1541 | 1541 | |
| 1542 | 1542 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1575 | 1575 | ); |
| 1576 | 1576 | |
| 1577 | 1577 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1578 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1578 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1579 | 1579 | $request->set_body( wp_json_encode( $params ) ); |
| 1580 | 1580 | |
| 1581 | 1581 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1598 | 1598 | ); |
| 1599 | 1599 | |
| 1600 | 1600 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1601 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1601 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1602 | 1602 | $request->set_body( wp_json_encode( $params ) ); |
| 1603 | 1603 | |
| 1604 | 1604 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1625 | 1625 | ); |
| 1626 | 1626 | |
| 1627 | 1627 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1628 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1628 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1629 | 1629 | $request->set_body( wp_json_encode( $params ) ); |
| 1630 | 1630 | $response = rest_get_server()->dispatch( $request ); |
| 1631 | 1631 | |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1654 | 1654 | ); |
| 1655 | 1655 | |
| 1656 | 1656 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1657 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1657 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1658 | 1658 | $request->set_body( wp_json_encode( $params ) ); |
| 1659 | 1659 | $response = rest_get_server()->dispatch( $request ); |
| 1660 | 1660 | |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1679 | 1679 | ); |
| 1680 | 1680 | |
| 1681 | 1681 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1682 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1682 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1683 | 1683 | $request->set_body( wp_json_encode( $params ) ); |
| 1684 | 1684 | $response = rest_get_server()->dispatch( $request ); |
| 1685 | 1685 | |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1699 | 1699 | ); |
| 1700 | 1700 | |
| 1701 | 1701 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1702 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1702 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1703 | 1703 | $request->set_body( wp_json_encode( $params ) ); |
| 1704 | 1704 | $response = rest_get_server()->dispatch( $request ); |
| 1705 | 1705 | |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1720 | 1720 | ); |
| 1721 | 1721 | |
| 1722 | 1722 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1723 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1723 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1724 | 1724 | $request->set_body( wp_json_encode( $params ) ); |
| 1725 | 1725 | $response = rest_get_server()->dispatch( $request ); |
| 1726 | 1726 | |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1744 | 1744 | ); |
| 1745 | 1745 | |
| 1746 | 1746 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1747 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1747 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1748 | 1748 | $request->set_body( wp_json_encode( $params ) ); |
| 1749 | 1749 | |
| 1750 | 1750 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1768 | 1768 | ); |
| 1769 | 1769 | |
| 1770 | 1770 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1771 | | $request->add_header( 'content-type', 'application/json' ); |
| 1772 | | $request->add_header( 'user_agent', 'Mozilla/4.0 (compatible; MSIE 5.5; AOL 4.0; Windows 95)' ); |
| | 1771 | $request->add_header( 'Content-Type', 'application/json' ); |
| | 1772 | $request->add_header( 'User-Agent', 'Mozilla/4.0 (compatible; MSIE 5.5; AOL 4.0; Windows 95)' ); |
| 1773 | 1773 | $request->set_body( wp_json_encode( $params ) ); |
| 1774 | 1774 | |
| 1775 | 1775 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1794 | 1794 | 'status' => 'approved', |
| 1795 | 1795 | ); |
| 1796 | 1796 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1797 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1797 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1798 | 1798 | $request->set_body( wp_json_encode( $params ) ); |
| 1799 | 1799 | $response = rest_get_server()->dispatch( $request ); |
| 1800 | 1800 | $data = $response->get_data(); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1815 | 1815 | 'status' => 'approved', |
| 1816 | 1816 | ); |
| 1817 | 1817 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1818 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1818 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1819 | 1819 | $request->set_body( wp_json_encode( $params ) ); |
| 1820 | 1820 | |
| 1821 | 1821 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1835 | 1835 | ); |
| 1836 | 1836 | |
| 1837 | 1837 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1838 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1838 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1839 | 1839 | $request->set_body( wp_json_encode( $params ) ); |
| 1840 | 1840 | $response = rest_get_server()->dispatch( $request ); |
| 1841 | 1841 | $this->assertErrorResponse( 'rest_comment_invalid_author_ip', $response, 403 ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1855 | 1855 | ); |
| 1856 | 1856 | |
| 1857 | 1857 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1858 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1858 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1859 | 1859 | $request->set_body( wp_json_encode( $params ) ); |
| 1860 | 1860 | $response = rest_get_server()->dispatch( $request ); |
| 1861 | 1861 | $data = $response->get_data(); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1875 | 1875 | ); |
| 1876 | 1876 | |
| 1877 | 1877 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1878 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1878 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1879 | 1879 | $request->set_body( wp_json_encode( $params ) ); |
| 1880 | 1880 | |
| 1881 | 1881 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1895 | 1895 | ); |
| 1896 | 1896 | |
| 1897 | 1897 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1898 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1898 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1899 | 1899 | $request->set_body( wp_json_encode( $params ) ); |
| 1900 | 1900 | |
| 1901 | 1901 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1915 | 1915 | ); |
| 1916 | 1916 | |
| 1917 | 1917 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1918 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1918 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1919 | 1919 | $request->set_body( wp_json_encode( $params ) ); |
| 1920 | 1920 | |
| 1921 | 1921 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1935 | 1935 | ); |
| 1936 | 1936 | |
| 1937 | 1937 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1938 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1938 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1939 | 1939 | $request->set_body( wp_json_encode( $params ) ); |
| 1940 | 1940 | |
| 1941 | 1941 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1955 | 1955 | ); |
| 1956 | 1956 | |
| 1957 | 1957 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1958 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1958 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1959 | 1959 | $request->set_body( wp_json_encode( $params ) ); |
| 1960 | 1960 | |
| 1961 | 1961 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1976 | 1976 | ); |
| 1977 | 1977 | |
| 1978 | 1978 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1979 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1979 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1980 | 1980 | $request->set_body( wp_json_encode( $params ) ); |
| 1981 | 1981 | |
| 1982 | 1982 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1996 | 1996 | ); |
| 1997 | 1997 | |
| 1998 | 1998 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 1999 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1999 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2000 | 2000 | $request->set_body( wp_json_encode( $params ) ); |
| 2001 | 2001 | |
| 2002 | 2002 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2023 | 2023 | ); |
| 2024 | 2024 | |
| 2025 | 2025 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 2026 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2026 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2027 | 2027 | $request->set_body( wp_json_encode( $params ) ); |
| 2028 | 2028 | $response = rest_get_server()->dispatch( $request ); |
| 2029 | 2029 | |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2044 | 2044 | ); |
| 2045 | 2045 | |
| 2046 | 2046 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 2047 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2047 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2048 | 2048 | $request->set_body( wp_json_encode( $params ) ); |
| 2049 | 2049 | $response = rest_get_server()->dispatch( $request ); |
| 2050 | 2050 | |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2075 | 2075 | ); |
| 2076 | 2076 | |
| 2077 | 2077 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 2078 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2078 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2079 | 2079 | $request->set_body( wp_json_encode( $params ) ); |
| 2080 | 2080 | |
| 2081 | 2081 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2093 | 2093 | ); |
| 2094 | 2094 | |
| 2095 | 2095 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 2096 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2096 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2097 | 2097 | $request->set_body( wp_json_encode( $params ) ); |
| 2098 | 2098 | |
| 2099 | 2099 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2117 | 2117 | ); |
| 2118 | 2118 | |
| 2119 | 2119 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 2120 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2120 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2121 | 2121 | $request->set_body( wp_json_encode( $params ) ); |
| 2122 | 2122 | |
| 2123 | 2123 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2132 | 2132 | ); |
| 2133 | 2133 | |
| 2134 | 2134 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 2135 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2135 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2136 | 2136 | $request->set_body( wp_json_encode( $params ) ); |
| 2137 | 2137 | |
| 2138 | 2138 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2156 | 2156 | ); |
| 2157 | 2157 | |
| 2158 | 2158 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 2159 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2159 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2160 | 2160 | $request->set_body( wp_json_encode( $params ) ); |
| 2161 | 2161 | |
| 2162 | 2162 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2183 | 2183 | |
| 2184 | 2184 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 2185 | 2185 | |
| 2186 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2186 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2187 | 2187 | $request->set_body( wp_json_encode( $params ) ); |
| 2188 | 2188 | $response = rest_get_server()->dispatch( $request ); |
| 2189 | 2189 | |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2207 | 2207 | |
| 2208 | 2208 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 2209 | 2209 | |
| 2210 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2210 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2211 | 2211 | $request->set_body( wp_json_encode( $params ) ); |
| 2212 | 2212 | $response = rest_get_server()->dispatch( $request ); |
| 2213 | 2213 | |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2231 | 2231 | |
| 2232 | 2232 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 2233 | 2233 | |
| 2234 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2234 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2235 | 2235 | $request->set_body( wp_json_encode( $params ) ); |
| 2236 | 2236 | $response = rest_get_server()->dispatch( $request ); |
| 2237 | 2237 | |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2255 | 2255 | |
| 2256 | 2256 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 2257 | 2257 | |
| 2258 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2258 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2259 | 2259 | $request->set_body( wp_json_encode( $params ) ); |
| 2260 | 2260 | $response = rest_get_server()->dispatch( $request ); |
| 2261 | 2261 | |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2275 | 2275 | |
| 2276 | 2276 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 2277 | 2277 | |
| 2278 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2278 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2279 | 2279 | $request->set_body( wp_json_encode( $params ) ); |
| 2280 | 2280 | $response = rest_get_server()->dispatch( $request ); |
| 2281 | 2281 | |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2296 | 2296 | |
| 2297 | 2297 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| 2298 | 2298 | |
| 2299 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2299 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2300 | 2300 | $request->set_body( wp_json_encode( $params ) ); |
| 2301 | 2301 | $response = rest_get_server()->dispatch( $request ); |
| 2302 | 2302 | $this->assertSame( 201, $response->get_status() ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2319 | 2319 | ); |
| 2320 | 2320 | |
| 2321 | 2321 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| 2322 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2322 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2323 | 2323 | $request->set_body( wp_json_encode( $params ) ); |
| 2324 | 2324 | |
| 2325 | 2325 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2424 | 2424 | ); |
| 2425 | 2425 | |
| 2426 | 2426 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', $comment_id ) ); |
| 2427 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2427 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2428 | 2428 | $request->set_body( wp_json_encode( $params ) ); |
| 2429 | 2429 | |
| 2430 | 2430 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2452 | 2452 | ); |
| 2453 | 2453 | |
| 2454 | 2454 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', $comment_id ) ); |
| 2455 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2455 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2456 | 2456 | $request->set_body( wp_json_encode( $params ) ); |
| 2457 | 2457 | |
| 2458 | 2458 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2474 | 2474 | ); |
| 2475 | 2475 | |
| 2476 | 2476 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| 2477 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2477 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2478 | 2478 | $request->set_body( wp_json_encode( $params ) ); |
| 2479 | 2479 | |
| 2480 | 2480 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2498 | 2498 | ); |
| 2499 | 2499 | |
| 2500 | 2500 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| 2501 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2501 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2502 | 2502 | $request->set_body( wp_json_encode( $params ) ); |
| 2503 | 2503 | |
| 2504 | 2504 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2518 | 2518 | ); |
| 2519 | 2519 | |
| 2520 | 2520 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| 2521 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2521 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2522 | 2522 | $request->set_body( wp_json_encode( $params ) ); |
| 2523 | 2523 | |
| 2524 | 2524 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2537 | 2537 | ); |
| 2538 | 2538 | |
| 2539 | 2539 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| 2540 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2540 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2541 | 2541 | $request->set_body( wp_json_encode( $params ) ); |
| 2542 | 2542 | |
| 2543 | 2543 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2557 | 2557 | ); |
| 2558 | 2558 | |
| 2559 | 2559 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| 2560 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2560 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2561 | 2561 | $request->set_body( wp_json_encode( $params ) ); |
| 2562 | 2562 | |
| 2563 | 2563 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2575 | 2575 | ); |
| 2576 | 2576 | |
| 2577 | 2577 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| 2578 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2578 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2579 | 2579 | $request->set_body( wp_json_encode( $params ) ); |
| 2580 | 2580 | $response = rest_get_server()->dispatch( $request ); |
| 2581 | 2581 | |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2592 | 2592 | ); |
| 2593 | 2593 | |
| 2594 | 2594 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| 2595 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2595 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2596 | 2596 | $request->set_body( wp_json_encode( $params ) ); |
| 2597 | 2597 | |
| 2598 | 2598 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2609 | 2609 | ); |
| 2610 | 2610 | |
| 2611 | 2611 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| 2612 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2612 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2613 | 2613 | $request->set_body( wp_json_encode( $params ) ); |
| 2614 | 2614 | |
| 2615 | 2615 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2630 | 2630 | ); |
| 2631 | 2631 | |
| 2632 | 2632 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| 2633 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2633 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2634 | 2634 | $request->set_body( wp_json_encode( $params ) ); |
| 2635 | 2635 | |
| 2636 | 2636 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2646 | 2646 | ); |
| 2647 | 2647 | |
| 2648 | 2648 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| 2649 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2649 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2650 | 2650 | $request->set_body( wp_json_encode( $params ) ); |
| 2651 | 2651 | |
| 2652 | 2652 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2661 | 2661 | ); |
| 2662 | 2662 | |
| 2663 | 2663 | $request = new WP_REST_Request( 'PUT', '/wp/v2/comments/' . REST_TESTS_IMPOSSIBLY_HIGH_NUMBER ); |
| 2664 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2664 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2665 | 2665 | $request->set_body( wp_json_encode( $params ) ); |
| 2666 | 2666 | |
| 2667 | 2667 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2686 | 2686 | ); |
| 2687 | 2687 | |
| 2688 | 2688 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$hold_id ) ); |
| 2689 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2689 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2690 | 2690 | $request->set_body( wp_json_encode( $params ) ); |
| 2691 | 2691 | |
| 2692 | 2692 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2705 | 2705 | ); |
| 2706 | 2706 | |
| 2707 | 2707 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| 2708 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2708 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2709 | 2709 | $request->set_body( wp_json_encode( $params ) ); |
| 2710 | 2710 | |
| 2711 | 2711 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2735 | 2735 | ); |
| 2736 | 2736 | |
| 2737 | 2737 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', $private_comment_id ) ); |
| 2738 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2738 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2739 | 2739 | $request->set_body( wp_json_encode( $params ) ); |
| 2740 | 2740 | |
| 2741 | 2741 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2794 | 2794 | |
| 2795 | 2795 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| 2796 | 2796 | |
| 2797 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2797 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2798 | 2798 | $request->set_body( wp_json_encode( $params ) ); |
| 2799 | 2799 | $response = rest_get_server()->dispatch( $request ); |
| 2800 | 2800 | |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2814 | 2814 | |
| 2815 | 2815 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| 2816 | 2816 | |
| 2817 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2817 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2818 | 2818 | $request->set_body( wp_json_encode( $params ) ); |
| 2819 | 2819 | $response = rest_get_server()->dispatch( $request ); |
| 2820 | 2820 | |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2834 | 2834 | |
| 2835 | 2835 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| 2836 | 2836 | |
| 2837 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2837 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2838 | 2838 | $request->set_body( wp_json_encode( $params ) ); |
| 2839 | 2839 | $response = rest_get_server()->dispatch( $request ); |
| 2840 | 2840 | |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2853 | 2853 | |
| 2854 | 2854 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| 2855 | 2855 | |
| 2856 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2856 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2857 | 2857 | $request->set_body( wp_json_encode( $params ) ); |
| 2858 | 2858 | $response = rest_get_server()->dispatch( $request ); |
| 2859 | 2859 | |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2874 | 2874 | |
| 2875 | 2875 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| 2876 | 2876 | |
| 2877 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2877 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2878 | 2878 | $request->set_body( wp_json_encode( $params ) ); |
| 2879 | 2879 | $response = rest_get_server()->dispatch( $request ); |
| 2880 | 2880 | |
-
diff --git tests/phpunit/tests/rest-api/rest-posts-controller.php tests/phpunit/tests/rest-api/rest-posts-controller.php
index 5fa7e3cf98..eccb1f24c6 100644
|
|
|
class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te |
| 2301 | 2301 | wp_set_current_user( self::$editor_id ); |
| 2302 | 2302 | |
| 2303 | 2303 | $request = new WP_REST_Request( 'POST', '/wp/v2/posts' ); |
| 2304 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 2304 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 2305 | 2305 | $params = $this->set_post_data(); |
| 2306 | 2306 | $request->set_body_params( $params ); |
| 2307 | 2307 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te |
| 2492 | 2492 | wp_set_current_user( self::$editor_id ); |
| 2493 | 2493 | |
| 2494 | 2494 | $request = new WP_REST_Request( 'POST', '/wp/v2/posts' ); |
| 2495 | | $request->add_header( 'content-type', 'application/json' ); |
| | 2495 | $request->add_header( 'Content-Type', 'application/json' ); |
| 2496 | 2496 | $params = $this->set_post_data(); |
| 2497 | 2497 | $request->set_body( wp_json_encode( $params ) ); |
| 2498 | 2498 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te |
| 3123 | 3123 | wp_set_current_user( self::$editor_id ); |
| 3124 | 3124 | |
| 3125 | 3125 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) ); |
| 3126 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 3126 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 3127 | 3127 | $params = $this->set_post_data(); |
| 3128 | 3128 | $request->set_body_params( $params ); |
| 3129 | 3129 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te |
| 3161 | 3161 | wp_set_current_user( self::$editor_id ); |
| 3162 | 3162 | |
| 3163 | 3163 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) ); |
| 3164 | | $request->add_header( 'content-type', 'application/json' ); |
| | 3164 | $request->add_header( 'Content-Type', 'application/json' ); |
| 3165 | 3165 | $params = $this->set_post_data(); |
| 3166 | 3166 | $request->set_body( wp_json_encode( $params ) ); |
| 3167 | 3167 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te |
| 3195 | 3195 | $future_date = '2919-07-29T18:00:00'; |
| 3196 | 3196 | |
| 3197 | 3197 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', $post_id ) ); |
| 3198 | | $request->add_header( 'content-type', 'application/json' ); |
| | 3198 | $request->add_header( 'Content-Type', 'application/json' ); |
| 3199 | 3199 | $params = $this->set_post_data( |
| 3200 | 3200 | array( |
| 3201 | 3201 | 'date_gmt' => $future_date, |
| … |
… |
class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te |
| 3217 | 3217 | |
| 3218 | 3218 | // Update post with a blank field (date or date_gmt). |
| 3219 | 3219 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', $post_id ) ); |
| 3220 | | $request->add_header( 'content-type', 'application/json' ); |
| | 3220 | $request->add_header( 'Content-Type', 'application/json' ); |
| 3221 | 3221 | $params = $this->set_post_data( |
| 3222 | 3222 | array( |
| 3223 | 3223 | 'date_gmt' => null, |
| … |
… |
class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te |
| 3244 | 3244 | wp_set_current_user( self::$editor_id ); |
| 3245 | 3245 | |
| 3246 | 3246 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) ); |
| 3247 | | $request->add_header( 'content-type', 'application/json' ); |
| | 3247 | $request->add_header( 'Content-Type', 'application/json' ); |
| 3248 | 3248 | $params = $this->set_raw_post_data(); |
| 3249 | 3249 | $request->set_body( wp_json_encode( $params ) ); |
| 3250 | 3250 | $response = rest_get_server()->dispatch( $request ); |
-
diff --git tests/phpunit/tests/rest-api/rest-request.php tests/phpunit/tests/rest-api/rest-request.php
index 509c754f65..cf1f3ac739 100644
|
|
|
class Tests_REST_Request extends WP_UnitTestCase { |
| 203 | 203 | * @ticket 49404 |
| 204 | 204 | * @dataProvider alternate_json_content_type_provider |
| 205 | 205 | * |
| 206 | | * @param string $content_type The content-type header. |
| | 206 | * @param string $content_type The Content-Type header. |
| 207 | 207 | * @param string $source The source value. |
| 208 | 208 | * @param bool $accept_json The accept_json value. |
| 209 | 209 | */ |
| … |
… |
class Tests_REST_Request extends WP_UnitTestCase { |
| 234 | 234 | * @ticket 49404 |
| 235 | 235 | * @dataProvider is_json_content_type_provider |
| 236 | 236 | * |
| 237 | | * @param string $content_type The content-type header. |
| | 237 | * @param string $content_type The Content-Type header. |
| 238 | 238 | * @param bool $is_json The is_json value. |
| 239 | 239 | */ |
| 240 | 240 | public function test_is_json_content_type( $content_type, $is_json ) { |
| … |
… |
class Tests_REST_Request extends WP_UnitTestCase { |
| 242 | 242 | |
| 243 | 243 | $this->request->set_header( 'Content-Type', $content_type ); |
| 244 | 244 | |
| 245 | | // Check for JSON content-type. |
| | 245 | // Check for JSON Content-Type. |
| 246 | 246 | $this->assertSame( $is_json, $this->request->is_json_content_type() ); |
| 247 | 247 | } |
| 248 | 248 | |
| … |
… |
class Tests_REST_Request extends WP_UnitTestCase { |
| 361 | 361 | ); |
| 362 | 362 | |
| 363 | 363 | $this->request->set_method( 'PUT' ); |
| 364 | | $this->request->add_header( 'content-type', 'application/json' ); |
| | 364 | $this->request->add_header( 'Content-Type', 'application/json' ); |
| 365 | 365 | $this->request->set_body( wp_json_encode( $data ) ); |
| 366 | 366 | |
| 367 | 367 | foreach ( $data as $key => $expected_value ) { |
| … |
… |
class Tests_REST_Request extends WP_UnitTestCase { |
| 383 | 383 | ); |
| 384 | 384 | |
| 385 | 385 | $this->request->set_method( 'POST' ); |
| 386 | | $this->request->add_header( 'content-type', 'application/json' ); |
| | 386 | $this->request->add_header( 'Content-Type', 'application/json' ); |
| 387 | 387 | $this->request->set_body( wp_json_encode( $data ) ); |
| 388 | 388 | |
| 389 | 389 | foreach ( $data as $key => $expected_value ) { |
| … |
… |
class Tests_REST_Request extends WP_UnitTestCase { |
| 864 | 864 | |
| 865 | 865 | public function test_set_param_follows_parameter_order() { |
| 866 | 866 | $request = new WP_REST_Request(); |
| 867 | | $request->add_header( 'content-type', 'application/json' ); |
| | 867 | $request->add_header( 'Content-Type', 'application/json' ); |
| 868 | 868 | $request->set_method( 'POST' ); |
| 869 | 869 | $request->set_body( |
| 870 | 870 | wp_json_encode( |
| … |
… |
class Tests_REST_Request extends WP_UnitTestCase { |
| 892 | 892 | */ |
| 893 | 893 | public function test_set_param_updates_param_in_json_and_query() { |
| 894 | 894 | $request = new WP_REST_Request(); |
| 895 | | $request->add_header( 'content-type', 'application/json' ); |
| | 895 | $request->add_header( 'Content-Type', 'application/json' ); |
| 896 | 896 | $request->set_method( 'POST' ); |
| 897 | 897 | $request->set_body( |
| 898 | 898 | wp_json_encode( |
| … |
… |
class Tests_REST_Request extends WP_UnitTestCase { |
| 919 | 919 | */ |
| 920 | 920 | public function test_set_param_updates_param_if_already_exists_in_query() { |
| 921 | 921 | $request = new WP_REST_Request(); |
| 922 | | $request->add_header( 'content-type', 'application/json' ); |
| | 922 | $request->add_header( 'Content-Type', 'application/json' ); |
| 923 | 923 | $request->set_method( 'POST' ); |
| 924 | 924 | $request->set_body( |
| 925 | 925 | wp_json_encode( |
| … |
… |
class Tests_REST_Request extends WP_UnitTestCase { |
| 953 | 953 | */ |
| 954 | 954 | public function test_set_param_to_null_updates_param_in_json_and_query() { |
| 955 | 955 | $request = new WP_REST_Request(); |
| 956 | | $request->add_header( 'content-type', 'application/json' ); |
| | 956 | $request->add_header( 'Content-Type', 'application/json' ); |
| 957 | 957 | $request->set_method( 'POST' ); |
| 958 | 958 | $request->set_body( |
| 959 | 959 | wp_json_encode( |
| … |
… |
class Tests_REST_Request extends WP_UnitTestCase { |
| 980 | 980 | */ |
| 981 | 981 | public function test_set_param_from_null_updates_param_in_json_and_query_with_null() { |
| 982 | 982 | $request = new WP_REST_Request(); |
| 983 | | $request->add_header( 'content-type', 'application/json' ); |
| | 983 | $request->add_header( 'Content-Type', 'application/json' ); |
| 984 | 984 | $request->set_method( 'POST' ); |
| 985 | 985 | $request->set_body( |
| 986 | 986 | wp_json_encode( |
| … |
… |
class Tests_REST_Request extends WP_UnitTestCase { |
| 1007 | 1007 | */ |
| 1008 | 1008 | public function test_set_param_with_invalid_json() { |
| 1009 | 1009 | $request = new WP_REST_Request(); |
| 1010 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1010 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1011 | 1011 | $request->set_method( 'POST' ); |
| 1012 | 1012 | $request->set_body( '' ); |
| 1013 | 1013 | $request->set_param( 'param', 'value' ); |
-
diff --git tests/phpunit/tests/rest-api/rest-settings-controller.php tests/phpunit/tests/rest-api/rest-settings-controller.php
index 60a5f28c8d..a2bbcb79c6 100644
|
|
|
class WP_Test_REST_Settings_Controller extends WP_Test_REST_Controller_Testcase |
| 773 | 773 | ), |
| 774 | 774 | ); |
| 775 | 775 | $request = new WP_REST_Request( 'PUT', '/wp/v2/settings' ); |
| 776 | | $request->add_header( 'content-type', 'application/json' ); |
| | 776 | $request->add_header( 'Content-Type', 'application/json' ); |
| 777 | 777 | $request->set_body( wp_json_encode( $data ) ); |
| 778 | 778 | |
| 779 | 779 | $response = rest_do_request( $request ); |
-
diff --git tests/phpunit/tests/rest-api/rest-users-controller.php tests/phpunit/tests/rest-api/rest-users-controller.php
index 849b0e5464..1f875df16b 100644
|
|
|
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 1230 | 1230 | ); |
| 1231 | 1231 | |
| 1232 | 1232 | $request = new WP_REST_Request( 'POST', '/wp/v2/users' ); |
| 1233 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 1233 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 1234 | 1234 | $request->set_body_params( $params ); |
| 1235 | 1235 | $response = rest_get_server()->dispatch( $request ); |
| 1236 | 1236 | |
| … |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | 1265 | $request = new WP_REST_Request( 'POST', '/wp/v2/users' ); |
| 1266 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 1266 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 1267 | 1267 | $request->set_body_params( $params ); |
| 1268 | 1268 | $response = rest_get_server()->dispatch( $request ); |
| 1269 | 1269 | $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); |
| … |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 1308 | 1308 | ); |
| 1309 | 1309 | |
| 1310 | 1310 | $request = new WP_REST_Request( 'POST', '/wp/v2/users' ); |
| 1311 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 1311 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 1312 | 1312 | $request->set_body_params( $params ); |
| 1313 | 1313 | $response = rest_get_server()->dispatch( $request ); |
| 1314 | 1314 | |
| … |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 1338 | 1338 | ); |
| 1339 | 1339 | |
| 1340 | 1340 | $request = new WP_REST_Request( 'POST', '/wp/v2/users' ); |
| 1341 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 1341 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 1342 | 1342 | $request->set_body_params( $params ); |
| 1343 | 1343 | $response = rest_get_server()->dispatch( $request ); |
| 1344 | 1344 | $data = $response->get_data(); |
| … |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 1369 | 1369 | add_filter( 'can_add_user_to_blog', '__return_false' ); |
| 1370 | 1370 | |
| 1371 | 1371 | $request = new WP_REST_Request( 'POST', '/wp/v2/users' ); |
| 1372 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 1372 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 1373 | 1373 | $request->set_body_params( $params ); |
| 1374 | 1374 | $response = rest_get_server()->dispatch( $request ); |
| 1375 | 1375 | $this->assertErrorResponse( 'user_cannot_be_added', $response ); |
| … |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 1392 | 1392 | switch_to_blog( self::$site ); |
| 1393 | 1393 | |
| 1394 | 1394 | $request = new WP_REST_Request( 'POST', '/wp/v2/users' ); |
| 1395 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 1395 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 1396 | 1396 | $request->set_body_params( $params ); |
| 1397 | 1397 | $response = rest_get_server()->dispatch( $request ); |
| 1398 | 1398 | $data = $response->get_data(); |
| … |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 1422 | 1422 | ); |
| 1423 | 1423 | |
| 1424 | 1424 | $request = new WP_REST_Request( 'POST', '/wp/v2/users' ); |
| 1425 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 1425 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 1426 | 1426 | $request->set_body_params( $params ); |
| 1427 | 1427 | $response = rest_get_server()->dispatch( $request ); |
| 1428 | 1428 | $data = $response->get_data(); |
| … |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 1431 | 1431 | switch_to_blog( self::$site ); |
| 1432 | 1432 | |
| 1433 | 1433 | $request = new WP_REST_Request( 'POST', '/wp/v2/users' ); |
| 1434 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 1434 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 1435 | 1435 | $request->set_body_params( $params ); |
| 1436 | 1436 | $switched_response = rest_get_server()->dispatch( $request ); |
| 1437 | 1437 | |
| … |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 1470 | 1470 | ); |
| 1471 | 1471 | |
| 1472 | 1472 | $request = new WP_REST_Request( 'POST', '/wp/v2/users' ); |
| 1473 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1473 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1474 | 1474 | $request->set_body( wp_json_encode( $params ) ); |
| 1475 | 1475 | $response = rest_get_server()->dispatch( $request ); |
| 1476 | 1476 | |
| … |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 1487 | 1487 | ); |
| 1488 | 1488 | |
| 1489 | 1489 | $request = new WP_REST_Request( 'POST', '/wp/v2/users' ); |
| 1490 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 1490 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 1491 | 1491 | $request->set_body_params( $params ); |
| 1492 | 1492 | $response = rest_get_server()->dispatch( $request ); |
| 1493 | 1493 | |
| … |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 1507 | 1507 | ); |
| 1508 | 1508 | |
| 1509 | 1509 | $request = new WP_REST_Request( 'POST', '/wp/v2/users' ); |
| 1510 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 1510 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 1511 | 1511 | $request->set_body_params( $params ); |
| 1512 | 1512 | $response = rest_get_server()->dispatch( $request ); |
| 1513 | 1513 | |
| … |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 1526 | 1526 | ); |
| 1527 | 1527 | |
| 1528 | 1528 | $request = new WP_REST_Request( 'POST', '/wp/v2/users' ); |
| 1529 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 1529 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 1530 | 1530 | $request->set_body_params( $params ); |
| 1531 | 1531 | $response = rest_get_server()->dispatch( $request ); |
| 1532 | 1532 | |
| … |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 1546 | 1546 | ); |
| 1547 | 1547 | |
| 1548 | 1548 | $request = new WP_REST_Request( 'POST', '/wp/v2/users' ); |
| 1549 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 1549 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 1550 | 1550 | $request->set_body_params( $params ); |
| 1551 | 1551 | $response = rest_get_server()->dispatch( $request ); |
| 1552 | 1552 | |
| … |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 1579 | 1579 | $_POST['locale'] = 'de_DE'; |
| 1580 | 1580 | |
| 1581 | 1581 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', $user_id ) ); |
| 1582 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 1582 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 1583 | 1583 | $request->set_body_params( $_POST ); |
| 1584 | 1584 | $response = rest_get_server()->dispatch( $request ); |
| 1585 | 1585 | |
| … |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 1826 | 1826 | $pw_before = $userdata->user_pass; |
| 1827 | 1827 | |
| 1828 | 1828 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', $user_id ) ); |
| 1829 | | $request->add_header( 'content-type', 'application/json' ); |
| | 1829 | $request->add_header( 'Content-Type', 'application/json' ); |
| 1830 | 1830 | $request->set_body( wp_json_encode( $params ) ); |
| 1831 | 1831 | |
| 1832 | 1832 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 2008 | 2008 | ); |
| 2009 | 2009 | |
| 2010 | 2010 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', self::$user ) ); |
| 2011 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 2011 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 2012 | 2012 | $request->set_body_params( $params ); |
| 2013 | 2013 | $response = rest_get_server()->dispatch( $request ); |
| 2014 | 2014 | |
| 2015 | 2015 | $this->assertErrorResponse( 'rest_cannot_edit', $response, 403 ); |
| 2016 | 2016 | |
| 2017 | 2017 | $request = new WP_REST_Request( 'PUT', '/wp/v2/users/me' ); |
| 2018 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 2018 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 2019 | 2019 | $request->set_body_params( $params ); |
| 2020 | 2020 | $response = rest_get_server()->dispatch( $request ); |
| 2021 | 2021 | |
| … |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 2035 | 2035 | ); |
| 2036 | 2036 | |
| 2037 | 2037 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', self::$editor ) ); |
| 2038 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 2038 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 2039 | 2039 | $request->set_body_params( $params ); |
| 2040 | 2040 | $response = rest_get_server()->dispatch( $request ); |
| 2041 | 2041 | |
| … |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 2881 | 2881 | wp_set_current_user( self::$user ); |
| 2882 | 2882 | |
| 2883 | 2883 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', $user_id ) ); |
| 2884 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 2884 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 2885 | 2885 | $request->set_body_params( array( 'first_name' => 'New Name' ) ); |
| 2886 | 2886 | $response = rest_get_server()->dispatch( $request ); |
| 2887 | 2887 | $this->assertErrorResponse( 'rest_user_invalid_id', $response, 404 ); |
| … |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 2903 | 2903 | wp_set_current_user( self::$superadmin ); |
| 2904 | 2904 | |
| 2905 | 2905 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', $user_id ) ); |
| 2906 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 2906 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 2907 | 2907 | $request->set_body_params( array( 'first_name' => 'New Name' ) ); |
| 2908 | 2908 | $response = rest_get_server()->dispatch( $request ); |
| 2909 | 2909 | $this->assertErrorResponse( 'rest_user_invalid_id', $response, 404 ); |
-
diff --git tests/phpunit/tests/rest-api/rest-widgets-controller.php tests/phpunit/tests/rest-api/rest-widgets-controller.php
index 28ac8bc6e3..dff2289278 100644
|
|
|
class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase { |
| 412 | 412 | |
| 413 | 413 | public function mocked_rss_response() { |
| 414 | 414 | $single_value_headers = array( |
| 415 | | 'content-type' => 'application/rss+xml; charset=UTF-8', |
| | 415 | 'Content-Type' => 'application/rss+xml; charset=UTF-8', |
| 416 | 416 | 'link' => '<https://wordpress.org/news/wp-json/>; rel="https://api.w.org/"', |
| 417 | 417 | ); |
| 418 | 418 | |
-
diff --git tests/phpunit/tests/rest-api/wpRestMenuItemsController.php tests/phpunit/tests/rest-api/wpRestMenuItemsController.php
index 9ef5b87d99..ecbc491256 100644
|
|
|
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 318 | 318 | wp_set_current_user( self::$admin_id ); |
| 319 | 319 | |
| 320 | 320 | $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' ); |
| 321 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 321 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 322 | 322 | $params = $this->set_menu_item_data(); |
| 323 | 323 | $request->set_body_params( $params ); |
| 324 | 324 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 334 | 334 | wp_set_current_user( self::$admin_id ); |
| 335 | 335 | |
| 336 | 336 | $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' ); |
| 337 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 337 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 338 | 338 | $params = $this->set_menu_item_data( |
| 339 | 339 | array( |
| 340 | 340 | 'menus' => array( 123, 456 ), |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 354 | 354 | wp_set_current_user( self::$admin_id ); |
| 355 | 355 | |
| 356 | 356 | $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' ); |
| 357 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 357 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 358 | 358 | $params = $this->set_menu_item_data( |
| 359 | 359 | array( |
| 360 | 360 | 'type' => 'taxonomy', |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 377 | 377 | $actual = array(); |
| 378 | 378 | for ( $i = 1; $i < 5; $i ++ ) { |
| 379 | 379 | $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' ); |
| 380 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 380 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 381 | 381 | $params = $this->set_menu_item_data( |
| 382 | 382 | array( |
| 383 | 383 | 'menu_order' => $i, |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 404 | 404 | $new_menu_id = wp_create_nav_menu( rand_str() ); |
| 405 | 405 | |
| 406 | 406 | $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' ); |
| 407 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 407 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 408 | 408 | $params = $this->set_menu_item_data( |
| 409 | 409 | array( |
| 410 | 410 | 'menu_order' => 0, |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 416 | 416 | $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); |
| 417 | 417 | |
| 418 | 418 | $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' ); |
| 419 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 419 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 420 | 420 | $params = $this->set_menu_item_data( |
| 421 | 421 | array( |
| 422 | 422 | 'menu_order' => 1, |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 436 | 436 | wp_set_current_user( self::$admin_id ); |
| 437 | 437 | $new_menu_id = wp_create_nav_menu( rand_str() ); |
| 438 | 438 | $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' ); |
| 439 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 439 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 440 | 440 | $params = $this->set_menu_item_data( |
| 441 | 441 | array( |
| 442 | 442 | 'menu_order' => 'ddddd', |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 456 | 456 | wp_set_current_user( self::$admin_id ); |
| 457 | 457 | $new_menu_id = wp_create_nav_menu( rand_str() ); |
| 458 | 458 | $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' ); |
| 459 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 459 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 460 | 460 | $params = $this->set_menu_item_data( |
| 461 | 461 | array( |
| 462 | 462 | 'menu_order' => -9, |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 476 | 476 | wp_set_current_user( self::$admin_id ); |
| 477 | 477 | wp_create_nav_menu( rand_str() ); |
| 478 | 478 | $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' ); |
| 479 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 479 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 480 | 480 | $params = $this->set_menu_item_data( |
| 481 | 481 | array( |
| 482 | 482 | 'parent' => -9, |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 494 | 494 | public function test_create_item_invalid_menu() { |
| 495 | 495 | wp_set_current_user( self::$admin_id ); |
| 496 | 496 | $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' ); |
| 497 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 497 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 498 | 498 | $params = $this->set_menu_item_data( |
| 499 | 499 | array( |
| 500 | 500 | 'menus' => -9, |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 513 | 513 | wp_set_current_user( self::$admin_id ); |
| 514 | 514 | |
| 515 | 515 | $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' ); |
| 516 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 516 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 517 | 517 | $params = $this->set_menu_item_data( |
| 518 | 518 | array( |
| 519 | 519 | 'type' => 'post_type', |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 533 | 533 | wp_set_current_user( self::$admin_id ); |
| 534 | 534 | |
| 535 | 535 | $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' ); |
| 536 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 536 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 537 | 537 | $params = $this->set_menu_item_data( |
| 538 | 538 | array( |
| 539 | 539 | 'type' => 'post_type_archive', |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 553 | 553 | wp_set_current_user( self::$admin_id ); |
| 554 | 554 | |
| 555 | 555 | $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' ); |
| 556 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 556 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 557 | 557 | $params = $this->set_menu_item_data( |
| 558 | 558 | array( |
| 559 | 559 | 'type' => 'custom', |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 573 | 573 | wp_set_current_user( self::$admin_id ); |
| 574 | 574 | |
| 575 | 575 | $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' ); |
| 576 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 576 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 577 | 577 | $params = $this->set_menu_item_data( |
| 578 | 578 | array( |
| 579 | 579 | 'type' => 'custom', |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 593 | 593 | wp_set_current_user( self::$admin_id ); |
| 594 | 594 | |
| 595 | 595 | $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' ); |
| 596 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 596 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 597 | 597 | $params = $this->set_menu_item_data( |
| 598 | 598 | array( |
| 599 | 599 | 'type' => 'custom', |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 615 | 615 | wp_set_current_user( self::$admin_id ); |
| 616 | 616 | |
| 617 | 617 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/menu-items/%d', $this->menu_item_id ) ); |
| 618 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 618 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 619 | 619 | $params = $this->set_menu_item_data( |
| 620 | 620 | array( |
| 621 | 621 | 'xfn' => array( 'test1', 'test2', 'test3' ), |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 648 | 648 | $good_data = array( 'test1', 'test2', 'test3', 'test4' ); |
| 649 | 649 | |
| 650 | 650 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/menu-items/%d', $this->menu_item_id ) ); |
| 651 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 651 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 652 | 652 | $params = $this->set_menu_item_data( |
| 653 | 653 | array( |
| 654 | 654 | 'xfn' => $bad_data, |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 680 | 680 | $post_id = self::factory()->post->create(); |
| 681 | 681 | |
| 682 | 682 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/menu-items/%d', $post_id ) ); |
| 683 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 683 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 684 | 684 | $params = $this->set_menu_item_data(); |
| 685 | 685 | $request->set_body_params( $params ); |
| 686 | 686 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 1021 | 1021 | wp_set_current_user( self::$admin_id ); |
| 1022 | 1022 | |
| 1023 | 1023 | $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' ); |
| 1024 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 1024 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 1025 | 1025 | $parameters = $this->set_menu_item_data( |
| 1026 | 1026 | array( |
| 1027 | 1027 | 'title' => 'Some \\\'title', |
| … |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
| 1043 | 1043 | wp_set_current_user( self::$admin_id ); |
| 1044 | 1044 | |
| 1045 | 1045 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/menu-items/%d', $this->menu_item_id ) ); |
| 1046 | | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
| | 1046 | $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 1047 | 1047 | $title = 'Some \\\'title'; |
| 1048 | 1048 | $params = $this->set_menu_item_data( |
| 1049 | 1049 | array( |
-
diff --git tests/phpunit/tests/widgets/wpWidgetRss.php tests/phpunit/tests/widgets/wpWidgetRss.php
index 495869f475..e5f65c6d15 100644
|
|
|
class Tests_Widgets_wpWidgetRss extends WP_UnitTestCase { |
| 101 | 101 | |
| 102 | 102 | public function mocked_rss_response() { |
| 103 | 103 | $single_value_headers = array( |
| 104 | | 'content-type' => 'application/rss+xml; charset=UTF-8', |
| | 104 | 'Content-Type' => 'application/rss+xml; charset=UTF-8', |
| 105 | 105 | 'link' => '<https://wordpress.org/news/wp-json/>; rel="https://api.w.org/"', |
| 106 | 106 | ); |
| 107 | 107 | |