- Timestamp:
- 04/15/2021 01:10:18 AM (5 years ago)
- Location:
- branches/5.0
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
tests/phpunit/tests/rest-api/rest-posts-controller.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0
-
branches/5.0/tests/phpunit/tests/rest-api/rest-posts-controller.php
r43930 r50731 1222 1222 1223 1223 $this->assertErrorResponse( 'rest_forbidden', $response, 401 ); 1224 } 1225 1226 public function test_get_post_draft_edit_context() { 1227 $post_content = 'Hello World!'; 1228 $this->factory->post->create( 1229 array( 1230 'post_title' => 'Hola', 1231 'post_password' => 'password', 1232 'post_content' => $post_content, 1233 'post_excerpt' => $post_content, 1234 'post_author' => self::$editor_id, 1235 ) 1236 ); 1237 $draft_id = $this->factory->post->create( 1238 array( 1239 'post_status' => 'draft', 1240 'post_author' => self::$contributor_id, 1241 'post_content' => '<!-- wp:latest-posts {"displayPostContent":true} /--> <!-- wp:latest-posts {"displayPostContent":true,"displayPostContentRadio":"full_post"} /-->', 1242 ) 1243 ); 1244 wp_set_current_user( self::$contributor_id ); 1245 $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/posts/%d', $draft_id ) ); 1246 $request->set_param( 'context', 'edit' ); 1247 $response = rest_get_server()->dispatch( $request ); 1248 $data = $response->get_data(); 1249 $this->assertNotContains( $post_content, $data['content']['rendered'] ); 1224 1250 } 1225 1251
Note: See TracChangeset
for help on using the changeset viewer.