| | 312 | * @ticket 27194 |
| | 313 | */ |
| | 314 | function test_clear_categories_on_edit() { |
| | 315 | $editor_id = $this->make_user_by_role( 'editor' ); |
| | 316 | |
| | 317 | $post_id = $this->factory->post->create( array( 'post_author' => $editor_id ) ); |
| | 318 | $term_id = $this->factory->category->create(); |
| | 319 | $this->factory->term->add_post_terms( $post_id, $term_id, 'category', true ); |
| | 320 | $term_ids = wp_list_pluck( get_the_category( $post_id ), 'term_id' ); |
| | 321 | $this->assertContains( $term_id, $term_ids ); |
| | 322 | |
| | 323 | $new_post_content = array( |
| | 324 | 'ID' => $post_id, |
| | 325 | 'post_title' => 'Updated', |
| | 326 | 'terms' => array( |
| | 327 | 'category' => array() |
| | 328 | ) |
| | 329 | ); |
| | 330 | $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $new_post_content ) ); |
| | 331 | $this->assertNotInstanceOf( 'IXR_Error', $result ); |
| | 332 | $this->assertEquals( 'Updated', get_post( $post_id )->post_title ); |
| | 333 | |
| | 334 | $term_ids = wp_list_pluck( get_the_category( $post_id ), 'term_id' ); |
| | 335 | $this->assertNotContains( $term_id, $term_ids ); |
| | 336 | } |
| | 337 | |
| | 338 | /** |