diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
index 9d33eaa475..6a68ee4826 100644
|
|
|
class WP_REST_Terms_Controller extends WP_REST_Controller {
|
| 978 | 978 | |
| 979 | 979 | $query_params['slug'] = array( |
| 980 | 980 | 'description' => __( 'Limit result set to terms with a specific slug.' ), |
| 981 | | 'type' => 'string', |
| | 981 | 'type' => 'array', |
| | 982 | 'items' => array( |
| | 983 | 'type' => 'string' |
| | 984 | ), |
| 982 | 985 | ); |
| 983 | 986 | |
| 984 | 987 | /** |
diff --git tests/phpunit/tests/rest-api/rest-categories-controller.php tests/phpunit/tests/rest-api/rest-categories-controller.php
index fbf7d06018..8ad6c36a66 100644
|
|
|
class WP_Test_REST_Categories_Controller extends WP_Test_REST_Controller_Testcas
|
| 417 | 417 | $this->assertEquals( 'Apple', $data[0]['name'] ); |
| 418 | 418 | } |
| 419 | 419 | |
| | 420 | public function test_get_items_slug_array_arg() { |
| | 421 | $id1 = $this->factory->category->create( array( 'name' => 'Taco' ) ); |
| | 422 | $id2 = $this->factory->category->create( array( 'name' => 'Enchilada' ) ); |
| | 423 | $id3 = $this->factory->category->create( array( 'name' => 'Burrito' ) ); |
| | 424 | $this->factory->category->create( array( 'name' => 'Pizza' ) ); |
| | 425 | $request = new WP_REST_Request( 'GET', '/wp/v2/categories' ); |
| | 426 | $request->set_param( 'slug', array( |
| | 427 | 'taco', |
| | 428 | 'burrito', |
| | 429 | 'enchilada', |
| | 430 | ) ); |
| | 431 | $response = $this->server->dispatch( $request ); |
| | 432 | $this->assertEquals( 200, $response->get_status() ); |
| | 433 | $data = $response->get_data(); |
| | 434 | $this->assertEquals( 3, count( $data ) ); |
| | 435 | $this->assertEquals( 'Burrito', $data[0]['name'] ); |
| | 436 | $this->assertEquals( 'Enchilada', $data[1]['name'] ); |
| | 437 | $this->assertEquals( 'Taco', $data[2]['name'] ); |
| | 438 | } |
| | 439 | |
| 420 | 440 | public function test_get_terms_parent_arg() { |
| 421 | 441 | $category1 = $this->factory->category->create( array( 'name' => 'Parent' ) ); |
| 422 | 442 | $this->factory->category->create( array( 'name' => 'Child', 'parent' => $category1 ) ); |
diff --git tests/phpunit/tests/rest-api/rest-tags-controller.php tests/phpunit/tests/rest-api/rest-tags-controller.php
index cb81b17159..8296c50627 100644
|
|
|
class WP_Test_REST_Tags_Controller extends WP_Test_REST_Controller_Testcase {
|
| 378 | 378 | $this->assertEquals( 'Apple', $data[0]['name'] ); |
| 379 | 379 | } |
| 380 | 380 | |
| | 381 | public function test_get_items_slug_array_arg() { |
| | 382 | $id1 = $this->factory->tag->create( array( 'name' => 'Taco' ) ); |
| | 383 | $id2 = $this->factory->tag->create( array( 'name' => 'Enchilada' ) ); |
| | 384 | $id3 = $this->factory->tag->create( array( 'name' => 'Burrito' ) ); |
| | 385 | $this->factory->tag->create( array( 'name' => 'Pizza' ) ); |
| | 386 | $request = new WP_REST_Request( 'GET', '/wp/v2/tags' ); |
| | 387 | $request->set_param( 'slug', array( |
| | 388 | 'taco', |
| | 389 | 'burrito', |
| | 390 | 'enchilada', |
| | 391 | ) ); |
| | 392 | $response = $this->server->dispatch( $request ); |
| | 393 | $this->assertEquals( 200, $response->get_status() ); |
| | 394 | $data = $response->get_data(); |
| | 395 | $this->assertEquals( 3, count( $data ) ); |
| | 396 | $this->assertEquals( 'Burrito', $data[0]['name'] ); |
| | 397 | $this->assertEquals( 'Enchilada', $data[1]['name'] ); |
| | 398 | $this->assertEquals( 'Taco', $data[2]['name'] ); |
| | 399 | } |
| | 400 | |
| 381 | 401 | public function test_get_terms_private_taxonomy() { |
| 382 | 402 | register_taxonomy( 'robin', 'post', array( 'public' => false ) ); |
| 383 | 403 | $term1 = $this->factory->term->create( array( 'name' => 'Cape', 'taxonomy' => 'robin' ) ); |