Changeset 44253
- Timestamp:
- 12/17/2018 01:05:03 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-autosaves-controller.php
r44250 r44253 82 82 ); 83 83 84 self::$draft_page_id = $factory->post->create( array( 85 'post_type' => 'page', 86 'post_status' => 'draft', 87 ) ); 88 self::$parent_page_id = $factory->post->create( array( 89 'post_type' => 'page', 90 ) ); 91 self::$child_page_id = $factory->post->create( array( 92 'post_type' => 'page', 93 'post_parent' => self::$parent_page_id, 94 ) ); 95 self::$child_draft_page_id = $factory->post->create( array( 96 'post_type' => 'page', 97 'post_parent' => self::$parent_page_id, 98 // The "update post" behavior of the autosave endpoint only occurs 99 // when saving a draft/auto-draft authored by the current user. 100 'post_status' => 'draft', 101 'post_author' => self::$editor_id, 102 ) ); 84 self::$draft_page_id = $factory->post->create( 85 array( 86 'post_type' => 'page', 87 'post_status' => 'draft', 88 ) 89 ); 90 self::$parent_page_id = $factory->post->create( 91 array( 92 'post_type' => 'page', 93 ) 94 ); 95 self::$child_page_id = $factory->post->create( 96 array( 97 'post_type' => 'page', 98 'post_parent' => self::$parent_page_id, 99 ) 100 ); 101 self::$child_draft_page_id = $factory->post->create( 102 array( 103 'post_type' => 'page', 104 'post_parent' => self::$parent_page_id, 105 // The "update post" behavior of the autosave endpoint only occurs 106 // when saving a draft/auto-draft authored by the current user. 107 'post_status' => 'draft', 108 'post_author' => self::$editor_id, 109 ) 110 ); 103 111 } 104 112 … … 145 153 146 154 public function test_registered_query_params() { 147 $request = new WP_REST_Request( 'OPTIONS', '/wp/v2/posts/' . self::$post_id . '/autosaves' );155 $request = new WP_REST_Request( 'OPTIONS', '/wp/v2/posts/' . self::$post_id . '/autosaves' ); 148 156 $response = $this->server->dispatch( $request ); 149 $data = $response->get_data();150 $keys = array_keys( $data['endpoints'][0]['args'] );157 $data = $response->get_data(); 158 $keys = array_keys( $data['endpoints'][0]['args'] ); 151 159 sort( $keys ); 152 $this->assertEquals( array( 153 'context', 154 'parent', 155 ), $keys ); 160 $this->assertEquals( 161 array( 162 'context', 163 'parent', 164 ), 165 $keys 166 ); 156 167 } 157 168 … … 580 591 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); 581 592 582 $params = $this->set_post_data( array( 583 'id' => self::$draft_page_id, 584 'comment_status' => 'garbage', 585 ) ); 593 $params = $this->set_post_data( 594 array( 595 'id' => self::$draft_page_id, 596 'comment_status' => 'garbage', 597 ) 598 ); 586 599 587 600 $request->set_body_params( $params );
Note: See TracChangeset
for help on using the changeset viewer.