Changeset 40602
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
r40571 r40602 1967 1967 'description' => __( 'The ID of the featured media for the object.' ), 1968 1968 'type' => 'integer', 1969 'context' => array( 'view', 'edit' ),1969 'context' => array( 'view', 'edit', 'embed' ), 1970 1970 ); 1971 1971 break; -
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r40545 r40602 2915 2915 } 2916 2916 2917 /** 2918 * @ticket 39805 2919 */ 2920 public function test_get_post_view_context_properties() { 2921 $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/posts/%d', self::$post_id ) ); 2922 $request->set_param( 'context', 'view' ); 2923 $response = $this->server->dispatch( $request ); 2924 $keys = array_keys( $response->get_data() ); 2925 sort( $keys ); 2926 2927 $expected_keys = array( 2928 'author', 2929 'categories', 2930 'comment_status', 2931 'content', 2932 'date', 2933 'date_gmt', 2934 'excerpt', 2935 'featured_media', 2936 'format', 2937 'guid', 2938 'id', 2939 'link', 2940 'meta', 2941 'modified', 2942 'modified_gmt', 2943 'ping_status', 2944 'slug', 2945 'status', 2946 'sticky', 2947 'tags', 2948 'template', 2949 'title', 2950 'type', 2951 ); 2952 2953 $this->assertEquals( $expected_keys, $keys ); 2954 } 2955 2956 public function test_get_post_edit_context_properties() { 2957 wp_set_current_user( self::$editor_id ); 2958 2959 $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/posts/%d', self::$post_id ) ); 2960 $request->set_param( 'context', 'edit' ); 2961 $response = $this->server->dispatch( $request ); 2962 $keys = array_keys( $response->get_data() ); 2963 sort( $keys ); 2964 2965 $expected_keys = array( 2966 'author', 2967 'categories', 2968 'comment_status', 2969 'content', 2970 'date', 2971 'date_gmt', 2972 'excerpt', 2973 'featured_media', 2974 'format', 2975 'guid', 2976 'id', 2977 'link', 2978 'meta', 2979 'modified', 2980 'modified_gmt', 2981 'password', 2982 'ping_status', 2983 'slug', 2984 'status', 2985 'sticky', 2986 'tags', 2987 'template', 2988 'title', 2989 'type', 2990 ); 2991 2992 $this->assertEquals( $expected_keys, $keys ); 2993 } 2994 2995 public function test_get_post_embed_context_properties() { 2996 $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/posts/%d', self::$post_id ) ); 2997 $request->set_param( 'context', 'embed' ); 2998 $response = $this->server->dispatch( $request ); 2999 $keys = array_keys( $response->get_data() ); 3000 sort( $keys ); 3001 3002 $expected_keys = array( 3003 'author', 3004 'date', 3005 'excerpt', 3006 'featured_media', 3007 'id', 3008 'link', 3009 'slug', 3010 'title', 3011 'type', 3012 ); 3013 3014 $this->assertEquals( $expected_keys, $keys ); 3015 } 3016 2917 3017 public function test_status_array_enum_args() { 2918 3018 $request = new WP_REST_Request( 'GET', '/wp/v2' );
Note: See TracChangeset
for help on using the changeset viewer.