diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php
index 203cea2530..5088ff7a24 100644
|
a
|
b
|
class WP_REST_Post_Types_Controller extends WP_REST_Controller { |
| 159 | 159 | 'capabilities' => $post_type->cap, |
| 160 | 160 | 'description' => $post_type->description, |
| 161 | 161 | 'hierarchical' => $post_type->hierarchical, |
| | 162 | 'previewable' => is_post_type_viewable( $post_type ), |
| 162 | 163 | 'labels' => $post_type->labels, |
| 163 | 164 | 'name' => $post_type->label, |
| 164 | 165 | 'slug' => $post_type->name, |
| … |
… |
class WP_REST_Post_Types_Controller extends WP_REST_Controller { |
| 229 | 230 | 'context' => array( 'view', 'edit' ), |
| 230 | 231 | 'readonly' => true, |
| 231 | 232 | ), |
| | 233 | 'previewable' => array( |
| | 234 | 'description' => __( 'Whether or not the post type can be previewed.' ), |
| | 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.' ), |
| 234 | 241 | 'type' => 'object', |
diff --git a/tests/phpunit/tests/rest-api/rest-post-types-controller.php b/tests/phpunit/tests/rest-api/rest-post-types-controller.php
index dfb233bf2e..ab9d5f35d4 100644
|
a
|
b
|
class WP_Test_REST_Post_Types_Controller extends WP_Test_REST_Controller_Testcas |
| 128 | 128 | $response = rest_get_server()->dispatch( $request ); |
| 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( 'previewable', $properties ); |
| 135 | 136 | $this->assertArrayHasKey( 'labels', $properties ); |
| 136 | 137 | $this->assertArrayHasKey( 'name', $properties ); |
| 137 | 138 | $this->assertArrayHasKey( 'slug', $properties ); |
| … |
… |
class WP_Test_REST_Post_Types_Controller extends WP_Test_REST_Controller_Testcas |
| 191 | 192 | if ( 'edit' === $context ) { |
| 192 | 193 | $this->assertEquals( $post_type_obj->cap, $data['capabilities'] ); |
| 193 | 194 | $this->assertEquals( $post_type_obj->labels, $data['labels'] ); |
| | 195 | $this->assertEquals( is_post_type_viewable( $post_type_obj ), $data['previewable'] ); |
| 194 | 196 | $this->assertEquals( get_all_post_type_supports( $post_type_obj->name ), $data['supports'] ); |
| 195 | 197 | } else { |
| 196 | 198 | $this->assertFalse( isset( $data['capabilities'] ) ); |
| | 199 | $this->assertFalse( isset( $data['previewable'] ) ); |
| 197 | 200 | $this->assertFalse( isset( $data['labels'] ) ); |
| 198 | 201 | $this->assertFalse( isset( $data['supports'] ) ); |
| 199 | 202 | } |