<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[39105] trunk: REST API: Clean-up our validation callbacks and add missing array `items` properties in our endpoint schemas.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/39105">39105</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/39105","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>rachelbaker</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-11-03 02:17:39 +0000 (Thu, 03 Nov 2016)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>REST API: Clean-up our validation callbacks and add missing array `items` properties in our endpoint schemas.
Props joehoyle, jnylen0.
Fixes <a href="https://core.trac.wordpress.org/ticket/38617">#38617</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesrestapiendpointsclasswprestattachmentscontrollerphp">trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php</a></li>
<li><a href="#trunksrcwpincludesrestapiendpointsclasswprestcommentscontrollerphp">trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php</a></li>
<li><a href="#trunksrcwpincludesrestapiendpointsclasswprestpostscontrollerphp">trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php</a></li>
<li><a href="#trunksrcwpincludesrestapiendpointsclasswpresttaxonomiescontrollerphp">trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php</a></li>
<li><a href="#trunksrcwpincludesrestapiendpointsclasswpresttermscontrollerphp">trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php</a></li>
<li><a href="#trunksrcwpincludesrestapiendpointsclasswprestuserscontrollerphp">trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php</a></li>
<li><a href="#trunktestsphpunittestsrestapirestcategoriescontrollerphp">trunk/tests/phpunit/tests/rest-api/rest-categories-controller.php</a></li>
<li><a href="#trunktestsphpunittestsrestapirestcommentscontrollerphp">trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php</a></li>
<li><a href="#trunktestsphpunittestsrestapirestpagescontrollerphp">trunk/tests/phpunit/tests/rest-api/rest-pages-controller.php</a></li>
<li><a href="#trunktestsphpunittestsrestapirestpostscontrollerphp">trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php</a></li>
<li><a href="#trunktestsphpunittestsrestapiresttagscontrollerphp">trunk/tests/phpunit/tests/rest-api/rest-tags-controller.php</a></li>
<li><a href="#trunktestsphpunittestsrestapirestuserscontrollerphp">trunk/tests/phpunit/tests/rest-api/rest-users-controller.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesrestapiendpointsclasswprestattachmentscontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php 2016-11-03 01:45:48 UTC (rev 39104)
+++ trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php 2016-11-03 02:17:39 UTC (rev 39105)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -594,7 +594,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to attachments of a particular media type.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><span class="cx" style="display: block; padding: 0 10px"> 'enum' => array_keys( $media_types ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $params['mime_type'] = array(
</span></span></pre></div>
<a id="trunksrcwpincludesrestapiendpointsclasswprestcommentscontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 2016-11-03 01:45:48 UTC (rev 39104)
+++ trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 2016-11-03 02:17:39 UTC (rev 39105)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1114,9 +1114,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><span class="cx" style="display: block; padding: 0 10px"> 'format' => 'ipv4',
</span><span class="cx" style="display: block; padding: 0 10px"> 'context' => array( 'edit' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'arg_options' => array(
- 'default' => '127.0.0.1',
- ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'default' => '127.0.0.1',
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'author_name' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Display name for the object author.' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1188,17 +1186,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'The id for the parent of the object.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'integer',
</span><span class="cx" style="display: block; padding: 0 10px"> 'context' => array( 'view', 'edit', 'embed' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'arg_options' => array(
- 'default' => 0,
- ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'default' => 0,
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'post' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'The id of the associated post object.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'integer',
</span><span class="cx" style="display: block; padding: 0 10px"> 'context' => array( 'view', 'edit' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'arg_options' => array(
- 'default' => 0,
- ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'default' => 0,
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'status' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'State of the object.' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1264,26 +1258,28 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><span class="cx" style="display: block; padding: 0 10px"> 'format' => 'date-time',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['author'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to comments assigned to specific user ids. Requires authorization.' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_id_list',
</del><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'integer',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['author_exclude'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Ensure result set excludes comments assigned to specific user ids. Requires authorization.' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_id_list',
</del><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'integer',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['author_email'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'default' => null,
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to that from a specific author email. Requires authorization.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'format' => 'email',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'sanitize_email',
</del><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1291,43 +1287,40 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><span class="cx" style="display: block; padding: 0 10px"> 'format' => 'date-time',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['exclude'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Ensure result set excludes specific ids.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'integer',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'default' => array(),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_id_list',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['include'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to specific ids.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'integer',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'default' => array(),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_id_list',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['karma'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'default' => null,
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to that of a particular comment karma. Requires authorization.' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'absint',
</del><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'integer',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['offset'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Offset the result set by a specific number of comments.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'integer',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'absint',
- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['order'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Order sort attribute ascending or descending.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'sanitize_key',
- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> 'default' => 'desc',
</span><span class="cx" style="display: block; padding: 0 10px"> 'enum' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'asc',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1338,8 +1331,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['orderby'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Sort collection by object attribute.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'sanitize_key',
- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> 'default' => 'date_gmt',
</span><span class="cx" style="display: block; padding: 0 10px"> 'enum' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'date',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1355,22 +1346,28 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['parent'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'default' => array(),
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to resources of specific parent ids.' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_id_list',
</del><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'integer',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['parent_exclude'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'default' => array(),
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Ensure result set excludes specific parent ids.' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_id_list',
</del><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'integer',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['post'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'default' => array(),
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to resources assigned to specific post ids.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_id_list',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'integer',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['status'] = array(
</span></span></pre></div>
<a id="trunksrcwpincludesrestapiendpointsclasswprestpostscontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 2016-11-03 01:45:48 UTC (rev 39104)
+++ trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 2016-11-03 02:17:39 UTC (rev 39105)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1975,22 +1975,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'items' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'integer',
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'arg_options' => array(
- 'sanitize_callback' => 'wp_parse_id_list',
- ),
</del><span class="cx" style="display: block; padding: 0 10px"> 'context' => array( 'view', 'edit' ),
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $schema['properties'][ $base . '_exclude' ] = array(
- 'description' => sprintf( __( 'The terms in the %s taxonomy that should not be assigned to the object.' ), $taxonomy->name ),
- 'type' => 'array',
- 'items' => array(
- 'type' => 'integer',
- ),
- 'arg_options' => array(
- 'sanitize_callback' => 'wp_parse_id_list',
- ),
- 'context' => array( 'view', 'edit' ),
- );
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->add_additional_fields_schema( $schema );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2013,21 +1999,24 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><span class="cx" style="display: block; padding: 0 10px"> 'format' => 'date-time',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( post_type_supports( $this->post_type, 'author' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $params['author'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to posts assigned to specific authors.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'integer',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'default' => array(),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_id_list',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> $params['author_exclude'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Ensure result set excludes posts assigned to specific authors.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'integer',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'default' => array(),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_id_list',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2035,37 +2024,36 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><span class="cx" style="display: block; padding: 0 10px"> 'format' => 'date-time',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $params['exclude'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Ensure result set excludes specific ids.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'integer',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'default' => array(),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_id_list',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $params['include'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to specific ids.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'integer',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'default' => array(),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_id_list',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'page' === $this->post_type || post_type_supports( $this->post_type, 'page-attributes' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $params['menu_order'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to resources with a specific menu_order value.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'integer',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'absint',
- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $params['offset'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Offset the result set by a specific number of items.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'integer',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'absint',
- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $params['order'] = array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2073,7 +2061,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><span class="cx" style="display: block; padding: 0 10px"> 'default' => 'desc',
</span><span class="cx" style="display: block; padding: 0 10px"> 'enum' => array( 'asc', 'desc' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $params['orderby'] = array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2088,7 +2075,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'title',
</span><span class="cx" style="display: block; padding: 0 10px"> 'slug',
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'page' === $this->post_type || post_type_supports( $this->post_type, 'page-attributes' ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2101,13 +2087,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $params['parent'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to those of particular parent ids.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_id_list',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'integer',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'default' => array(),
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> $params['parent_exclude'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to all items except those of a particular parent id.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_id_list',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'integer',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'default' => array(),
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2137,16 +2127,26 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $params[ $base ] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => sprintf( __( 'Limit result set to all items that have the specified term assigned in the %s taxonomy.' ), $base ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_id_list',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'integer',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'default' => array(),
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $params[ $base . '_exclude' ] = array(
+ 'description' => sprintf( __( 'Limit result set to all items except those that have the specified term assigned in the %s taxonomy.' ), $base ),
+ 'type' => 'array',
+ 'items' => array(
+ 'type' => 'integer',
+ ),
+ 'default' => array(),
+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'post' === $this->post_type ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $params['sticky'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to items that are sticky.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'boolean',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'rest_parse_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpincludesrestapiendpointsclasswpresttaxonomiescontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php 2016-11-03 01:45:48 UTC (rev 39104)
+++ trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php 2016-11-03 02:17:39 UTC (rev 39105)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -304,7 +304,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $new_params['type'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit results to resources associated with a specific post type.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> return $new_params;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludesrestapiendpointsclasswpresttermscontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php 2016-11-03 01:45:48 UTC (rev 39104)
+++ trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php 2016-11-03 02:17:39 UTC (rev 39105)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -887,42 +887,41 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['exclude'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Ensure result set excludes specific ids.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'integer',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'default' => array(),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_id_list',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['include'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to specific ids.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'integer',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'default' => array(),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_id_list',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $taxonomy->hierarchical ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['offset'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Offset the result set by a specific number of items.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'integer',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'absint',
- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['order'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Order sort attribute ascending or descending.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'sanitize_key',
</del><span class="cx" style="display: block; padding: 0 10px"> 'default' => 'asc',
</span><span class="cx" style="display: block; padding: 0 10px"> 'enum' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'asc',
</span><span class="cx" style="display: block; padding: 0 10px"> 'desc',
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['orderby'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Sort collection by resource attribute.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'sanitize_key',
</del><span class="cx" style="display: block; padding: 0 10px"> 'default' => 'name',
</span><span class="cx" style="display: block; padding: 0 10px"> 'enum' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'id',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -933,23 +932,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'description',
</span><span class="cx" style="display: block; padding: 0 10px"> 'count',
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['hide_empty'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Whether to hide resources not assigned to any posts.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'boolean',
</span><span class="cx" style="display: block; padding: 0 10px"> 'default' => false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'rest_sanitize_request_arg',
- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $taxonomy->hierarchical ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['parent'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to resources assigned to a specific parent.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'integer',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'absint',
- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -957,13 +951,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to resources assigned to a specific post.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'integer',
</span><span class="cx" style="display: block; padding: 0 10px"> 'default' => null,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['slug'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to resources with a specific slug.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $query_params;
</span></span></pre></div>
<a id="trunksrcwpincludesrestapiendpointsclasswprestuserscontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php 2016-11-03 01:45:48 UTC (rev 39104)
+++ trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php 2016-11-03 02:17:39 UTC (rev 39105)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1102,9 +1102,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'context' => array( 'edit' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'arg_options' => array(
- 'sanitize_callback' => 'wp_parse_slug_list',
- ),
</del><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'password' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Password for the resource (never included).' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1171,31 +1168,31 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['exclude'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Ensure result set excludes specific ids.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'integer',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'default' => array(),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_id_list',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['include'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to specific ids.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'integer',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'default' => array(),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_id_list',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['offset'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Offset the result set by a specific number of items.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'integer',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'absint',
- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['order'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'default' => 'asc',
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Order sort attribute ascending or descending.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'enum' => array( 'asc', 'desc' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'sanitize_key',
</del><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['orderby'] = array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1210,21 +1207,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'email',
</span><span class="cx" style="display: block; padding: 0 10px"> 'url',
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'sanitize_key',
</del><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['slug'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to resources with a specific slug.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'validate_callback' => 'rest_validate_request_arg',
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query_params['roles'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Limit result set to resources matching at least one specific role provided. Accepts csv list or single role.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sanitize_callback' => 'wp_parse_slug_list',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'items' => array(
+ 'type' => 'string',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $query_params;
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapirestcategoriescontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/rest-categories-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/rest-categories-controller.php 2016-11-03 01:45:48 UTC (rev 39104)
+++ trunk/tests/phpunit/tests/rest-api/rest-categories-controller.php 2016-11-03 02:17:39 UTC (rev 39105)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -428,6 +428,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 'Child', $data[0]['name'] );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function test_get_terms_invalid_parent_arg() {
+ $category1 = $this->factory->category->create( array( 'name' => 'Parent' ) );
+ $this->factory->category->create( array( 'name' => 'Child', 'parent' => $category1 ) );
+ $request = new WP_REST_Request( 'GET', '/wp/v2/categories' );
+ $request->set_param( 'parent', 'invalid-parent' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> public function test_get_terms_private_taxonomy() {
</span><span class="cx" style="display: block; padding: 0 10px"> register_taxonomy( 'robin', 'post', array( 'public' => false ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->factory->term->create( array( 'name' => 'Cape', 'taxonomy' => 'robin' ) );
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapirestcommentscontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php 2016-11-03 01:45:48 UTC (rev 39104)
+++ trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php 2016-11-03 02:17:39 UTC (rev 39105)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -300,6 +300,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 2, count( $data ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $id3, $data[0]['id'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Orderby=>invalid should fail.
+ $request->set_param( 'orderby', 'invalid' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
+ // fails on invalid id.
+ $request->set_param( 'orderby', array( 'include' ) );
+ $request->set_param( 'include', array( 'invalid' ) );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_exclude_query() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -320,6 +329,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( in_array( $id1, wp_list_pluck( $data, 'id' ), true ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( in_array( $id2, wp_list_pluck( $data, 'id' ), true ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // fails on invalid id.
+ $request->set_param( 'exclude', array( 'invalid' ) );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_offset_query() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -343,6 +357,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $request->set_param( 'page', 3 );
</span><span class="cx" style="display: block; padding: 0 10px"> $response = $this->server->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertCount( 2, $response->get_data() );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // 'offset' with invalid value errors.
+ $request->set_param( 'offset', 'moreplease' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_order_query() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -364,6 +382,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $response = $this->server->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( self::$approved_id, $data[0]['id'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // order=>asc,id should fail
+ $request->set_param( 'order', 'asc,id' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_private_post_no_permissions() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -402,8 +424,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 200, $response->get_status() );
</span><span class="cx" style="display: block; padding: 0 10px"> $comments = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertCount( 2, $comments );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Invalid author param errors
+ $request->set_param( 'author', 'skippy' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> // Unavailable to unauthenticated; defaults to error
</span><span class="cx" style="display: block; padding: 0 10px"> wp_set_current_user( 0 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $request->set_param( 'author', array( self::$author_id, self::$subscriber_id ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> $response = $this->server->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertErrorResponse( 'rest_forbidden_param', $response, 401 );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -441,8 +468,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 200, $response->get_status() );
</span><span class="cx" style="display: block; padding: 0 10px"> $comments = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertCount( 2, $comments );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // 'author_exclude' for both invalid author
+ $request = new WP_REST_Request( 'GET', '/wp/v2/comments' );
+ $request->set_param( 'author_exclude', 'skippy' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> // Unavailable to unauthenticated; defaults to error
</span><span class="cx" style="display: block; padding: 0 10px"> wp_set_current_user( 0 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $request->set_param( 'author_exclude', array( self::$author_id, self::$subscriber_id ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> $response = $this->server->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertErrorResponse( 'rest_forbidden_param', $response, 401 );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -470,6 +503,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $request->set_param( 'parent', array( $parent_id, $parent_id2 ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $response = $this->server->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertCount( 2, $response->get_data() );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Invalid parent should error
+ $request->set_param( 'parent', 'invalid' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_parent_exclude_arg() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -495,6 +532,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $request->set_param( 'parent_exclude', array( $parent_id, $parent_id2 ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $response = $this->server->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertCount( 3, $response->get_data() );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Invalid parent id should error
+ $request->set_param( 'parent_exclude', 'invalid' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_search_query() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -957,6 +998,28 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $comment_id, $collection_data[0]['id'] );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function test_create_comment_invalid_email() {
+ $post_id = $this->factory->post->create();
+ wp_set_current_user( self::$admin_id );
+
+ $params = array(
+ 'post' => $post_id,
+ 'author' => self::$admin_id,
+ 'author_name' => 'Comic Book Guy',
+ 'author_email' => 'hello:)',
+ 'author_url' => 'http://androidsdungeon.com',
+ 'content' => 'Worst Comment Ever!',
+ 'date' => '2014-11-07T10:14:25',
+ );
+
+ $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
+ $request->add_header( 'content-type', 'application/json' );
+ $request->set_body( wp_json_encode( $params ) );
+
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> public function test_create_item_current_user() {
</span><span class="cx" style="display: block; padding: 0 10px"> $user_id = $this->factory->user->create( array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'role' => 'subscriber',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1057,6 +1120,47 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertErrorResponse( 'rest_comment_invalid_karma', $response, 403 );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function test_create_comment_invalid_post() {
+ wp_set_current_user( self::$subscriber_id );
+
+ $params = array(
+ 'post' => 'some-slug',
+ 'author_name' => 'Homer Jay Simpson',
+ 'author_email' => 'chunkylover53@aol.com',
+ 'author_url' => 'http://compuglobalhypermeganet.com',
+ 'content' => 'Here\’s to alcohol: the cause of, and solution to, all of life\’s problems.',
+ 'author' => self::$subscriber_id,
+ );
+
+ $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
+ $request->add_header( 'content-type', 'application/json' );
+ $request->set_body( wp_json_encode( $params ) );
+ $response = $this->server->dispatch( $request );
+
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
+ }
+
+ public function test_create_comment_karma_invalid_value() {
+ wp_set_current_user( self::$subscriber_id );
+
+ $params = array(
+ 'post' => self::$post_id,
+ 'author_name' => 'Homer Jay Simpson',
+ 'author_email' => 'chunkylover53@aol.com',
+ 'author_url' => 'http://compuglobalhypermeganet.com',
+ 'content' => 'Here\’s to alcohol: the cause of, and solution to, all of life\’s problems.',
+ 'author' => self::$subscriber_id,
+ 'karma' => 'themostkarmaever',
+ );
+
+ $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
+ $request->add_header( 'content-type', 'application/json' );
+ $request->set_body( wp_json_encode( $params ) );
+ $response = $this->server->dispatch( $request );
+
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> public function test_create_comment_status_without_permission() {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_set_current_user( self::$subscriber_id );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1893,6 +1997,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey( 'post', $properties );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey( 'status', $properties );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey( 'type', $properties );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $this->assertEquals( '127.0.0.1', $properties['author_ip']['default'] );
+ $this->assertEquals( 0, $properties['parent']['default'] );
+ $this->assertEquals( 0, $properties['post']['default'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_item_schema_show_avatar() {
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapirestpagescontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/rest-pages-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/rest-pages-controller.php 2016-11-03 01:45:48 UTC (rev 39104)
+++ trunk/tests/phpunit/tests/rest-api/rest-pages-controller.php 2016-11-03 02:17:39 UTC (rev 39105)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -95,6 +95,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 1, count( $data ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $id2, $data[0]['id'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Invalid parent should fail
+ $request->set_param( 'parent', 'some-slug' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_parents_query() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -129,6 +133,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 1, count( $data ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $id1, $data[0]['id'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Invalid parent_exclude should error
+ $request->set_param( 'parent_exclude', 'some-slug' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_menu_order_query() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -156,6 +164,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $id4, $data[1]['id'] );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $id2, $data[2]['id'] );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $id3, $data[3]['id'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Invalid menu_order should fail
+ $request = new WP_REST_Request( 'GET', '/wp/v2/pages' );
+ $request->set_param( 'menu_order', 'top-first' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_min_max_pages_query() {
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapirestpostscontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php 2016-11-03 01:45:48 UTC (rev 39104)
+++ trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php 2016-11-03 02:17:39 UTC (rev 39105)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -92,6 +92,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'author_exclude',
</span><span class="cx" style="display: block; padding: 0 10px"> 'before',
</span><span class="cx" style="display: block; padding: 0 10px"> 'categories',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'categories_exclude',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'context',
</span><span class="cx" style="display: block; padding: 0 10px"> 'exclude',
</span><span class="cx" style="display: block; padding: 0 10px"> 'include',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -105,6 +106,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'status',
</span><span class="cx" style="display: block; padding: 0 10px"> 'sticky',
</span><span class="cx" style="display: block; padding: 0 10px"> 'tags',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'tags_exclude',
</ins><span class="cx" style="display: block; padding: 0 10px"> ), $keys );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -183,6 +185,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 2, count( $data ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertNotEquals( self::$editor_id, $data[0]['author'] );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertNotEquals( self::$editor_id, $data[1]['author'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // invalid author_exclude errors
+ $request = new WP_REST_Request( 'GET', '/wp/v2/posts' );
+ $request->set_param( 'author_exclude', 'invalid' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_include_query() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -202,6 +209,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 2, count( $data ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $id1, $data[0]['id'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Invalid include should error
+ $request = new WP_REST_Request( 'GET', '/wp/v2/posts' );
+ $request->set_param( 'include', 'invalid' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_exclude_query() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -224,6 +236,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( in_array( $id1, wp_list_pluck( $data, 'id' ), true ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( in_array( $id2, wp_list_pluck( $data, 'id' ), true ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $request->set_param( 'exclude', 'invalid' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_search_query() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -406,6 +422,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $response = $this->server->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 'Apple Cobbler', $data[0]['title']['rendered'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // order=>asc,id should fail
+ $request->set_param( 'order', 'asc,id' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
+ // orderby=>content should fail (invalid param test)
+ $request->set_param( 'order', 'asc' );
+ $request->set_param( 'orderby', 'content' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_with_orderby_relevance() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -456,6 +481,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $request->set_param( 'page', 3 );
</span><span class="cx" style="display: block; padding: 0 10px"> $response = $this->server->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertCount( 2, $response->get_data() );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Invalid 'offset' should error
+ $request->set_param( 'offset', 'moreplease' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_tags_query() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -512,6 +541,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $response = $this->server->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertCount( 1, $response->get_data() );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $request->set_param( 'tags', array( 'my-tag' ) );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_tags_and_categories_exclude_query() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -534,6 +567,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertCount( 1, $data );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $id2, $data[0]['id'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $request->set_param( 'tags_exclude', array( 'my-tag' ) );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_sticky_query() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -551,6 +588,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $posts = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $post = $posts[0];
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $id2, $post['id'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $request->set_param( 'sticky', 'nothanks' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_sticky_with_post__in_query() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1989,7 +2030,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $response = $this->server->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $properties = $data['schema']['properties'];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertEquals( 25, count( $properties ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertEquals( 23, count( $properties ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey( 'author', $properties );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey( 'comment_status', $properties );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey( 'content', $properties );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2012,9 +2053,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey( 'title', $properties );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey( 'type', $properties );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey( 'tags', $properties );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertArrayHasKey( 'tags_exclude', $properties );
</del><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey( 'categories', $properties );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertArrayHasKey( 'categories_exclude', $properties );
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_status_array_enum_args() {
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapiresttagscontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/rest-tags-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/rest-tags-controller.php 2016-11-03 01:45:48 UTC (rev 39104)
+++ trunk/tests/phpunit/tests/rest-api/rest-tags-controller.php 2016-11-03 02:17:39 UTC (rev 39105)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -98,6 +98,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 2, count( $data ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 'Season 5', $data[0]['name'] );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 'The Be Sharps', $data[1]['name'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // invalid value should fail
+ $request->set_param( 'hide_empty', 'nothanks' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_include_query() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -117,6 +121,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 2, count( $data ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $id3, $data[0]['id'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Include invalid value shoud fail
+ $request->set_param( 'include', array( 'myterm' ) );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_exclude_query() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -132,6 +140,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( in_array( $id1, wp_list_pluck( $data, 'id' ), true ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( in_array( $id2, wp_list_pluck( $data, 'id' ), true ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Invalid exclude value should fail
+ $request->set_param( 'exclude', array( 'invalid' ) );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_offset_query() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -151,6 +163,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $request->set_param( 'page', 3 );
</span><span class="cx" style="display: block; padding: 0 10px"> $response = $this->server->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertCount( 2, $response->get_data() );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // 'offset' invalid value shoudl fail
+ $request->set_param( 'offset', 'moreplease' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -181,6 +197,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 2, count( $data ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 'Apple', $data[0]['name'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Invalid orderby should fail.
+ $request->set_param( 'orderby', 'invalid' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_orderby_id() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -231,6 +251,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 2, count( $data ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 'DC', $data[0]['name'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Invalid post should error.
+ $request = new WP_REST_Request( 'GET', '/wp/v2/tags' );
+ $request->set_param( 'post', 'invalid-post' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_terms_post_args_paging() {
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapirestuserscontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/rest-users-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/rest-users-controller.php 2016-11-03 01:45:48 UTC (rev 39104)
+++ trunk/tests/phpunit/tests/rest-api/rest-users-controller.php 2016-11-03 02:17:39 UTC (rev 39105)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -363,6 +363,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertErrorResponse( 'rest_forbidden_orderby', $response, 401 );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function test_get_items_invalid_order() {
+ $request = new WP_REST_Request( 'GET', '/wp/v2/users' );
+ $request->set_param( 'order', 'asc,id' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
+ }
+
+ public function test_get_items_invalid_orderby() {
+ $request = new WP_REST_Request( 'GET', '/wp/v2/users' );
+ $request->set_param( 'orderby', 'invalid' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_offset() {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_set_current_user( self::$user );
</span><span class="cx" style="display: block; padding: 0 10px"> // 2 users created in __construct(), plus default user
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -379,6 +393,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $request->set_param( 'page', 3 );
</span><span class="cx" style="display: block; padding: 0 10px"> $response = $this->server->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertCount( 2, $response->get_data() );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // 'offset' invalid value should error
+ $request->set_param( 'offset', 'moreplease' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_include_query() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -399,7 +417,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 2, count( $data ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $id3, $data[0]['id'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Invalid include should fail
+ $request->set_param( 'include', 'invalid' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> // No privileges
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $request->set_param( 'include', array( $id3, $id1 ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_set_current_user( 0 );
</span><span class="cx" style="display: block; padding: 0 10px"> $response = $this->server->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $response->get_data();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -421,6 +444,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( in_array( $id1, wp_list_pluck( $data, 'id' ), true ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( in_array( $id2, wp_list_pluck( $data, 'id' ), true ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Invalid exlude value should error.
+ $request->set_param( 'exclude', 'none-of-those-please' );
+ $response = $this->server->dispatch( $request );
+ $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_items_search() {
</span></span></pre>
</div>
</div>
</body>
</html>