- Timestamp:
- 04/15/2021 01:09:07 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.1/tests/phpunit/tests/rest-api/rest-posts-controller.php
r44452 r50730 1430 1430 1431 1431 $this->assertErrorResponse( 'rest_forbidden', $response, 401 ); 1432 } 1433 1434 public function test_get_post_draft_edit_context() { 1435 $post_content = 'Hello World!'; 1436 $this->factory->post->create( 1437 array( 1438 'post_title' => 'Hola', 1439 'post_password' => 'password', 1440 'post_content' => $post_content, 1441 'post_excerpt' => $post_content, 1442 'post_author' => self::$editor_id, 1443 ) 1444 ); 1445 $draft_id = $this->factory->post->create( 1446 array( 1447 'post_status' => 'draft', 1448 'post_author' => self::$contributor_id, 1449 'post_content' => '<!-- wp:latest-posts {"displayPostContent":true} /--> <!-- wp:latest-posts {"displayPostContent":true,"displayPostContentRadio":"full_post"} /-->', 1450 ) 1451 ); 1452 wp_set_current_user( self::$contributor_id ); 1453 $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/posts/%d', $draft_id ) ); 1454 $request->set_param( 'context', 'edit' ); 1455 $response = rest_get_server()->dispatch( $request ); 1456 $data = $response->get_data(); 1457 $this->assertNotContains( $post_content, $data['content']['rendered'] ); 1432 1458 } 1433 1459
Note: See TracChangeset
for help on using the changeset viewer.