- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-categories-controller.php
r47118 r47122 114 114 115 115 public function test_context_param() { 116 // Collection 116 // Collection. 117 117 $request = new WP_REST_Request( 'OPTIONS', '/wp/v2/categories' ); 118 118 $response = rest_get_server()->dispatch( $request ); … … 120 120 $this->assertEquals( 'view', $data['endpoints'][0]['args']['context']['default'] ); 121 121 $this->assertEqualSets( array( 'view', 'embed', 'edit' ), $data['endpoints'][0]['args']['context']['enum'] ); 122 // Single 122 // Single. 123 123 $category1 = $this->factory->category->create( array( 'name' => 'Season 5' ) ); 124 124 $request = new WP_REST_Request( 'OPTIONS', '/wp/v2/categories/' . $category1 ); … … 442 442 $this->assertEquals( 3, count( $data ) ); 443 443 444 // Check ordered by name by default 444 // Check ordered by name by default. 445 445 $names = wp_list_pluck( $data, 'name' ); 446 446 $this->assertEquals( array( 'DC', 'Image', 'Marvel' ), $names ); … … 450 450 $post_id = $this->post_with_categories(); 451 451 452 // Regular request 452 // Regular request. 453 453 $request = new WP_REST_Request( 'GET', '/wp/v2/categories' ); 454 454 $request->set_param( 'post', $post_id ); … … 462 462 $this->assertEquals( array( 'Image', 'Marvel', 'DC' ), $names, 'Terms should be ordered by description' ); 463 463 464 // Flip the order 464 // Flip the order. 465 465 $request->set_param( 'order', 'desc' ); 466 466 $response = rest_get_server()->dispatch( $request );
Note: See TracChangeset
for help on using the changeset viewer.