mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 21:00:21 +00:00
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 git-svn-id: https://develop.svn.wordpress.org/trunk@31195 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
class Tests_Comment extends WP_UnitTestCase {
|
||||
function test_wp_update_comment() {
|
||||
$post = $this->factory->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post' ) );
|
||||
$post2 = $this->factory->post->create_and_get( array( 'post_title' => 'some-post-2', 'post_type' => 'post' ) );
|
||||
$comments = $this->factory->comment->create_post_comments( $post->ID, 5 );
|
||||
$result = wp_update_comment( array( 'comment_ID' => $comments[0], 'comment_parent' => $comments[1] ) );
|
||||
$this->assertEquals( 1, $result );
|
||||
@@ -13,6 +14,9 @@ class Tests_Comment extends WP_UnitTestCase {
|
||||
$this->assertEquals( $comments[1], $comment->comment_parent );
|
||||
$result = wp_update_comment( array( 'comment_ID' => $comments[0], 'comment_parent' => $comments[1] ) );
|
||||
$this->assertEquals( 0, $result );
|
||||
$result = wp_update_comment( array( 'comment_ID' => $comments[0], 'comment_post_ID' => $post2->ID ) );
|
||||
$comment = get_comment( $comments[0] );
|
||||
$this->assertEquals( $post2->ID, $comment->comment_post_ID );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user