Changeset 43038
- Timestamp:
- 04/30/2018 04:30:23 AM (7 years ago)
- Location:
- branches/4.9
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
-
branches/4.9/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php
r41731 r43038 156 156 'description' => $post_type->description, 157 157 'hierarchical' => $post_type->hierarchical, 158 'viewable' => is_post_type_viewable( $post_type ), 158 159 'labels' => $post_type->labels, 159 160 'name' => $post_type->label, … … 224 225 'readonly' => true, 225 226 ), 227 'viewable' => array( 228 'description' => __( 'Whether or not the post type can be viewed.' ), 229 'type' => 'boolean', 230 'context' => array( 'edit' ), 231 'readonly' => true, 232 ), 226 233 'labels' => array( 227 234 'description' => __( 'Human-readable labels for the post type for various contexts.' ), -
branches/4.9/tests/phpunit/tests/rest-api/rest-post-types-controller.php
r41176 r43038 129 129 $data = $response->get_data(); 130 130 $properties = $data['schema']['properties']; 131 $this->assertEquals( 9, count( $properties ) );131 $this->assertEquals( 10, count( $properties ) ); 132 132 $this->assertArrayHasKey( 'capabilities', $properties ); 133 133 $this->assertArrayHasKey( 'description', $properties ); 134 134 $this->assertArrayHasKey( 'hierarchical', $properties ); 135 $this->assertArrayHasKey( 'viewable', $properties ); 135 136 $this->assertArrayHasKey( 'labels', $properties ); 136 137 $this->assertArrayHasKey( 'name', $properties ); … … 190 191 $this->assertEquals( $post_type_obj->cap, $data['capabilities'] ); 191 192 $this->assertEquals( $post_type_obj->labels, $data['labels'] ); 193 if ( in_array( $post_type_obj->name, array( 'post', 'page' ), true ) ) { 194 $viewable = true; 195 } else { 196 $viewable = is_post_type_viewable( $post_type_obj ); 197 } 198 $this->assertEquals( $viewable, $data['viewable'] ); 192 199 $this->assertEquals( get_all_post_type_supports( $post_type_obj->name ), $data['supports'] ); 193 200 } else { 194 201 $this->assertFalse( isset( $data['capabilities'] ) ); 202 $this->assertFalse( isset( $data['viewable'] ) ); 195 203 $this->assertFalse( isset( $data['labels'] ) ); 196 204 $this->assertFalse( isset( $data['supports'] ) );
Note: See TracChangeset
for help on using the changeset viewer.