Make WordPress Core


Ignore:
Timestamp:
03/05/2014 06:25:31 AM (11 years ago)
Author:
nacin
Message:

Always convert auto-drafts to drafts in edit_draft() and _wp_translate_postdata().

This regressed due to refactoring in [26995]. This commit fixes Quick Draft.

see #25272.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/admin/includesPost.php

    r25002 r27405  
    115115        wp_set_current_user( 0 );
    116116    }
     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
    117139}
Note: See TracChangeset for help on using the changeset viewer.