Make WordPress Core

Ticket #20662: 20662.4.diff

File 20662.4.diff, 1.7 KB (added by ocean90, 10 years ago)
  • src/wp-includes/class-wp-xmlrpc-server.php

     
    52815281                if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) {
    52825282                        $data = $newpost;
    52835283                        $data['sticky'] = $content_struct['sticky'];
     5284                        $data['post_type'] = 'post';
    52845285                        $error = $this->_toggle_sticky( $data, true );
    52855286                        if ( $error ) {
    52865287                                return $error;
  • tests/phpunit/tests/xmlrpc/mw/editPost.php

     
    113113                $out = get_post( $post_id );
    114114                $this->assertEquals( $editor_id, $out->post_author );
    115115        }
    116        
     116
    117117        function test_post_thumbnail() {
    118118                add_theme_support( 'post-thumbnails' );
    119119
     
    203203                $this->assertEquals( $post4['mt_excerpt'], $out->post_excerpt );
    204204        }
    205205
     206        /**
     207         * @ticket 20662
     208         */
     209        function test_make_post_sticky() {
     210                $author_id = $this->make_user_by_role( 'editor' );
     211
     212                $post = array( 'post_title' => 'Title', 'post_content' => 'Content', 'post_author' => $author_id, 'post_status' => 'publish' );
     213                $post_id = wp_insert_post( $post );
     214
     215                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', array( 'sticky' => '1' ) ) );
     216                $this->assertNotInstanceOf( 'IXR_Error', $result );
     217                $this->assertTrue( $result );
     218        }
     219
    206220        // Not allowed since [19914]
    207221        function test_change_post_type() {
    208222                $contributor_id = $this->make_user_by_role( 'contributor' );