Changeset 43007
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php
r42343 r43007 160 160 'description' => $post_type->description, 161 161 'hierarchical' => $post_type->hierarchical, 162 'viewable' => is_post_type_viewable( $post_type ), 162 163 'labels' => $post_type->labels, 163 164 'name' => $post_type->label, … … 230 231 'readonly' => true, 231 232 ), 233 'viewable' => array( 234 'description' => __( 'Whether or not the post type can be viewed.' ), 235 'type' => 'boolean', 236 'context' => array( 'edit' ), 237 'readonly' => true, 238 ), 232 239 'labels' => array( 233 240 'description' => __( 'Human-readable labels for the post type for various contexts.' ), -
trunk/tests/phpunit/tests/rest-api/rest-post-types-controller.php
r42724 r43007 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 ); … … 192 193 $this->assertEquals( $post_type_obj->cap, $data['capabilities'] ); 193 194 $this->assertEquals( $post_type_obj->labels, $data['labels'] ); 195 if ( in_array( $post_type_obj->name, array( 'post', 'page' ), true ) ) { 196 $viewable = true; 197 } else { 198 $viewable = is_post_type_viewable( $post_type_obj ); 199 } 200 $this->assertEquals( $viewable, $data['viewable'] ); 194 201 $this->assertEquals( get_all_post_type_supports( $post_type_obj->name ), $data['supports'] ); 195 202 } else { 196 203 $this->assertFalse( isset( $data['capabilities'] ) ); 204 $this->assertFalse( isset( $data['viewable'] ) ); 197 205 $this->assertFalse( isset( $data['labels'] ) ); 198 206 $this->assertFalse( isset( $data['supports'] ) );
Note: See TracChangeset
for help on using the changeset viewer.