Changeset 27405
- Timestamp:
- 03/05/2014 06:25:31 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/post.php
r27373 r27405 84 84 85 85 // No longer an auto-draft 86 if ( 'auto-draft' == $post_data['post_status'] )86 if ( 'auto-draft' === $post_data['post_status'] ) { 87 87 $post_data['post_status'] = 'draft'; 88 } 88 89 } 89 90 … … 114 115 $post_data['post_status'] = 'pending'; 115 116 116 if ( ! isset($post_data['post_status']) ) 117 $post_data['post_status'] = $previous_status; 117 if ( ! isset( $post_data['post_status'] ) ) { 118 $post_data['post_status'] = 'auto-draft' === $previous_status ? 'draft' : $previous_status; 119 } 118 120 119 121 if (!isset( $post_data['comment_status'] )) -
trunk/tests/phpunit/tests/admin/includesPost.php
r25002 r27405 115 115 wp_set_current_user( 0 ); 116 116 } 117 118 /** 119 * edit_post() should convert an existing auto-draft to a draft. 120 * 121 * @ticket 25272 122 */ 123 function test_edit_post_auto_draft() { 124 $user_id = $this->factory->user->create( array( 'role' => 'editor' ) ); 125 wp_set_current_user( $user_id ); 126 $post = $this->factory->post->create_and_get( array( 'post_status' => 'auto-draft' ) ); 127 $this->assertEquals( 'auto-draft', $post->post_status ); 128 $post_data = array( 129 'post_title' => 'Post title', 130 'content' => 'Post content', 131 'post_type' => 'post', 132 'post_ID' => $post->ID, 133 ); 134 edit_post( $post_data ); 135 $this->assertEquals( 'draft', get_post( $post->ID )->post_status ); 136 wp_set_current_user( 0 ); 137 } 138 117 139 }
Note: See TracChangeset
for help on using the changeset viewer.