Make WordPress Core


Ignore:
Timestamp:
11/03/2016 02:17:39 AM (10 years ago)
Author:
rachelbaker
Message:

REST API: Clean-up our validation callbacks and add missing array items properties in our endpoint schemas.

Props joehoyle, jnylen0.
Fixes #38617.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-categories-controller.php

    r38975 r39105  
    429429        }
    430430
     431        public function test_get_terms_invalid_parent_arg() {
     432                $category1 = $this->factory->category->create( array( 'name' => 'Parent' ) );
     433                $this->factory->category->create( array( 'name' => 'Child', 'parent' => $category1 ) );
     434                $request = new WP_REST_Request( 'GET', '/wp/v2/categories' );
     435                $request->set_param( 'parent', 'invalid-parent' );
     436                $response = $this->server->dispatch( $request );
     437                $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
     438        }
     439
    431440        public function test_get_terms_private_taxonomy() {
    432441                register_taxonomy( 'robin', 'post', array( 'public' => false ) );
Note: See TracChangeset for help on using the changeset viewer.