Make WordPress Core

Changeset 1133 in tests


Ignore:
Timestamp:
11/14/2012 04:51:54 AM (11 years ago)
Author:
nacin
Message:

Test the loss of categories when using XML-RPC's wp.editPost. see #WP22220.

File:
1 edited

Legend:

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

    r1109 r1133  
    288288        $this->assertEquals( 'draft', get_post( $post_id )->post_status );
    289289    }
     290
     291    /**
     292     * @ticket 22220
     293     */
     294    function test_loss_of_categories_on_edit() {
     295        $editor_id = $this->make_user_by_role( 'editor' );
     296
     297        $post_id = $this->factory->post->create();
     298        $term_id = $this->factory->category->create();
     299        $this->factory->term->add_post_terms( $post_id, $term_id, 'category', true );
     300        $term_ids = wp_list_pluck( get_the_category( $post_id ), 'term_id' );
     301        $this->assertContains( $term_id, $term_ids );
     302
     303        $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, array( 'ID' => $post_id, 'post_title' => 'Updated' ) ) );
     304        $this->assertEquals( 'Updated', get_post( $post_id )->post_title );
     305
     306        $term_ids = wp_list_pluck( get_the_category( $post_id ), 'term_id' );
     307        $this->assertContains( $term_id, $term_ids );
     308    }
    290309}
Note: See TracChangeset for help on using the changeset viewer.