Make WordPress Core


Ignore:
Timestamp:
03/22/2016 03:11:06 PM (8 years ago)
Author:
rachelbaker
Message:

XMLRPC: Unit tests left off [r37043]

See #35874.

Props redsweater, rachelbaker

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/xmlrpc/wp/editPost.php

    r35242 r37044  
    402402        $this->assertTrue( in_array( $enclosure_string, get_post_meta( $post_id, 'enclosure' ) ) );
    403403    }
     404
     405    /**
     406     * @ticket 35874
     407     */
     408    function test_draft_not_prematurely_published() {
     409        $editor_id = $this->make_user_by_role( 'editor' );
     410
     411        /**
     412         * We have to use wp_newPost method, rather than the factory
     413         * post->create method to create the database conditions that exhibit
     414         * the bug.
     415         */
     416        $post = array(
     417            'post_title'  => 'Test',
     418            'post_status' => 'draft',
     419        );
     420        $post_id = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
     421
     422        // Change the post's status to publish and date to future.
     423        $future_time = strtotime( '+1 day' );
     424        $future_date = new IXR_Date( $future_time );
     425        $new_post_content = array(
     426            'ID'          => $post_id,
     427            'post_title'  => 'Updated',
     428            'post_status' => 'publish',
     429            'post_date'   => $future_date,
     430        );
     431
     432        $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $new_post_content ) );
     433
     434        $after = get_post( $post_id );
     435        $this->assertEquals( 'future', $after->post_status );
     436
     437        $future_date_string = strftime( '%Y-%m-%d %H:%M:%S', $future_time );
     438        $this->assertEquals( $future_date_string, $after->post_date );
     439    }
    404440}
Note: See TracChangeset for help on using the changeset viewer.