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/mw/editPost.php

    r36163 r37044  
    242242        $this->assertEmpty( $tags2 );
    243243    }
     244
     245    /**
     246     * @ticket 35874
     247     */
     248    function test_draft_not_prematurely_published() {
     249        $editor_id = $this->make_user_by_role( 'editor' );
     250
     251        $post = array(
     252            'title' => 'Title',
     253        );
     254
     255        /**
     256         * We have to use wp_newPost method, rather than the factory
     257         * post->create method to create the database conditions that exhibit
     258         * the bug.
     259         */
     260        $post_id = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
     261
     262        // Change the post's status to publish and date to future.
     263        $future_time = strtotime( '+1 day' );
     264        $future_date = new IXR_Date( $future_time );
     265        $this->myxmlrpcserver->mw_editPost( array(
     266            $post_id,
     267            'editor',
     268            'editor',
     269            array(
     270                'dateCreated' => $future_date,
     271                'post_status' => 'publish',
     272            ),
     273        ) );
     274
     275        $after = get_post( $post_id );
     276        $this->assertEquals( 'future', $after->post_status );
     277
     278        $future_date_string = strftime( '%Y-%m-%d %H:%M:%S', $future_time );
     279        $this->assertEquals( $future_date_string, $after->post_date );
     280    }
    244281}
Note: See TracChangeset for help on using the changeset viewer.