WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/16/2015 02:38:30 AM (6 years ago)
Author:
pento
Message:

Allow comment_post_ID to be passed to wp_update_comment(), so that a comment can be moved to a different post.

Props tyxla, rachelbaker

Fixes #30946

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/comment.php

    r31172 r31195  
    77    function test_wp_update_comment() {
    88        $post = $this->factory->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post' ) );
     9        $post2 = $this->factory->post->create_and_get( array( 'post_title' => 'some-post-2', 'post_type' => 'post' ) );
    910        $comments = $this->factory->comment->create_post_comments( $post->ID, 5 );
    1011        $result = wp_update_comment( array( 'comment_ID' => $comments[0], 'comment_parent' => $comments[1] ) );
     
    1415        $result = wp_update_comment( array( 'comment_ID' => $comments[0], 'comment_parent' => $comments[1] ) );
    1516        $this->assertEquals( 0, $result );
     17        $result = wp_update_comment( array( 'comment_ID' => $comments[0], 'comment_post_ID' => $post2->ID ) );
     18        $comment = get_comment( $comments[0] );
     19        $this->assertEquals( $post2->ID, $comment->comment_post_ID );
    1620    }
    1721
Note: See TracChangeset for help on using the changeset viewer.