Changeset 28073
- Timestamp:
- 04/11/2014 04:33:06 AM (9 years ago)
- Location:
- branches/3.8
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.8/src/wp-admin/includes/post.php
r27991 r28073 204 204 } 205 205 206 if ( ( empty( $post_data['action'] ) || 'autosave' != $post_data['action'] ) && 'auto-draft' == $post_data['post_status'] ) {207 $post_data['post_status'] = 'draft';208 }209 210 206 if ( isset($post_data['visibility']) ) { 211 207 switch ( $post_data['visibility'] ) { … … 227 223 if ( is_wp_error($post_data) ) 228 224 wp_die( $post_data->get_error_message() ); 225 226 if ( ( empty( $post_data['action'] ) || 'autosave' != $post_data['action'] ) && 'auto-draft' == $post_data['post_status'] ) { 227 $post_data['post_status'] = 'draft'; 228 } 229 229 230 230 // Post Formats -
branches/3.8/tests/phpunit/tests/admin/includesPost.php
r25002 r28073 5 5 */ 6 6 class Tests_Admin_includesPost extends WP_UnitTestCase { 7 8 function tearDown() { 9 wp_set_current_user( 0 ); 10 parent::tearDown(); 11 } 7 12 8 13 function test__wp_translate_postdata_cap_checks_contributor() { … … 57 62 $this->assertEquals( 'edit_others_posts', $_results->get_error_code() ); 58 63 $this->assertEquals( 'You are not allowed to edit posts as this user.', $_results->get_error_message() ); 59 60 wp_set_current_user( 0 );61 64 } 62 65 … … 112 115 $this->assertEquals( $_post_data['post_author'], $_results['post_author'] ); 113 116 $this->assertEquals( 'draft', $_results['post_status'] ); 117 } 114 118 115 wp_set_current_user( 0 ); 119 /** 120 * @ticket 27734 121 */ 122 function test_edit_post_promotes_auto_draft_to_draft() { 123 $admin = $this->factory->user->create( array( 'role' => 'administrator' ) ); 124 wp_set_current_user( $admin ); 125 126 $post = get_default_post_to_edit( 'post', true ); 127 $post_data = array( 128 'post_ID' => $post->ID, 129 'post_type' => 'post', 130 'post_content' => 'Some content', 131 ); 132 $this->assertEquals( 'auto-draft', $post->post_status ); 133 edit_post( $post_data ); 134 $updated = get_post( $post->ID ); 135 $this->assertEquals( 'draft', $updated->post_status ); 116 136 } 117 137 }
Note: See TracChangeset
for help on using the changeset viewer.