comment.php 702 B

1234567891011121314151617
  1. <?php
  2. /**
  3. * @group comment
  4. */
  5. class Tests_Comment extends WP_UnitTestCase {
  6. function test_wp_update_comment() {
  7. $post = $this->factory->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post' ) );
  8. $comments = $this->factory->comment->create_post_comments( $post->ID, 5 );
  9. $result = wp_update_comment( array( 'comment_ID' => $comments[0], 'comment_parent' => $comments[1] ) );
  10. $this->assertEquals( 1, $result );
  11. $comment = get_comment( $comments[0] );
  12. $this->assertEquals( $comments[1], $comment->comment_parent );
  13. $result = wp_update_comment( array( 'comment_ID' => $comments[0], 'comment_parent' => $comments[1] ) );
  14. $this->assertEquals( 0, $result );
  15. }
  16. }