Make WordPress Core

Changeset 1035 in tests for trunk/tests/comment.php


Ignore:
Timestamp:
09/21/2012 12:57:49 PM (13 years ago)
Author:
ryan
Message:

Basic wp_update_comment() tests. see #WP21706

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/comment.php

    r984 r1035  
    3535    }
    3636}
     37
     38/**
     39 * @group comment
     40 */
     41class Tests_Comment extends WP_UnitTestCase {
     42    function test_wp_update_comment() {
     43        $post = $this->factory->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post' ) );
     44        $comments = $this->factory->comment->create_post_comments( $post_id, 5 );
     45        $result = wp_update_comment( array( 'comment_ID' => $comments[0], 'comment_parent' => $comments[1] ) );
     46        $this->assertEquals( 1, $result );
     47        $comment = get_comment( $comments[0] );
     48        $this->assertEquals( $comments[1], $comment->comment_parent );
     49        $result = wp_update_comment( array( 'comment_ID' => $comments[0], 'comment_parent' => $comments[1] ) );
     50        $this->assertEquals( 0, $result );
     51    }
     52}
Note: See TracChangeset for help on using the changeset viewer.