- Timestamp:
- 11/02/2016 09:50:08 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-post-types-controller.php
r38832 r39097 59 59 $response = $this->server->dispatch( $request ); 60 60 $this->check_post_type_object_response( 'view', $response ); 61 $data = $response->get_data(); 62 $this->assertEquals( array( 'category', 'post_tag' ), $data['taxonomies'] ); 63 } 64 65 public function test_get_item_page() { 66 $request = new WP_REST_Request( 'GET', '/wp/v2/types/page' ); 67 $response = $this->server->dispatch( $request ); 68 $this->check_post_type_object_response( 'view', $response, 'page' ); 69 $data = $response->get_data(); 70 $this->assertEquals( array(), $data['taxonomies'] ); 61 71 } 62 72 … … 110 120 $data = $response->get_data(); 111 121 $properties = $data['schema']['properties']; 112 $this->assertEquals( 6, count( $properties ) );122 $this->assertEquals( 7, count( $properties ) ); 113 123 $this->assertArrayHasKey( 'capabilities', $properties ); 114 124 $this->assertArrayHasKey( 'description', $properties ); … … 117 127 $this->assertArrayHasKey( 'name', $properties ); 118 128 $this->assertArrayHasKey( 'slug', $properties ); 129 $this->assertArrayHasKey( 'taxonomies', $properties ); 119 130 } 120 131 … … 173 184 } 174 185 175 protected function check_post_type_object_response( $context, $response ) {186 protected function check_post_type_object_response( $context, $response, $post_type = 'post' ) { 176 187 $this->assertEquals( 200, $response->get_status() ); 177 188 $data = $response->get_data(); 178 $obj = get_post_type_object( 'post');189 $obj = get_post_type_object( $post_type ); 179 190 $this->check_post_type_obj( $context, $obj, $data, $response->get_links() ); 180 191 }
Note: See TracChangeset
for help on using the changeset viewer.