- Timestamp:
- 11/25/2024 11:14:37 AM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-tags-controller.php
r56746 r59458 481 481 $this->assertCount( 2, $data ); 482 482 $this->assertSame( 'Cape', $data[0]['name'] ); 483 } 484 485 /** 486 * @ticket 62500 487 */ 488 public function test_get_items_custom_tax_without_post_arg_respects_tax_query_args() { 489 register_taxonomy( 490 'batman', 491 'post', 492 array( 493 'show_in_rest' => true, 494 'sort' => true, 495 'args' => array( 496 'order' => 'DESC', 497 'orderby' => 'name', 498 ), 499 ) 500 ); 501 $controller = new WP_REST_Terms_Controller( 'batman' ); 502 $controller->register_routes(); 503 $term1 = self::factory()->term->create( 504 array( 505 'name' => 'Cycle', 506 'taxonomy' => 'batman', 507 ) 508 ); 509 $term2 = self::factory()->term->create( 510 array( 511 'name' => 'Pod', 512 'taxonomy' => 'batman', 513 ) 514 ); 515 $term3 = self::factory()->term->create( 516 array( 517 'name' => 'Cave', 518 'taxonomy' => 'batman', 519 ) 520 ); 521 522 $request = new WP_REST_Request( 'GET', '/wp/v2/batman' ); 523 $response = rest_get_server()->dispatch( $request ); 524 $this->assertSame( 200, $response->get_status() ); 525 526 $data = $response->get_data(); 527 $this->assertCount( 3, $data ); 528 $this->assertSame( 529 array( 'Pod', 'Cycle', 'Cave' ), 530 array_column( $data, 'name' ) 531 ); 483 532 } 484 533
Note: See TracChangeset
for help on using the changeset viewer.