Changeset 48235 for trunk/tests/phpunit/tests/comment.php
- Timestamp:
- 06/30/2020 02:11:00 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment.php
r48231 r48235 32 32 33 33 public function test_wp_update_comment() { 34 $post 34 $post = self::factory()->post->create_and_get( 35 35 array( 36 36 'post_title' => 'some-post', … … 38 38 ) 39 39 ); 40 $post2 40 $post2 = self::factory()->post->create_and_get( 41 41 array( 42 42 'post_title' => 'some-post-2', … … 44 44 ) 45 45 ); 46 46 47 $comments = self::factory()->comment->create_post_comments( $post->ID, 5 ); 47 $result = wp_update_comment( 48 49 $result = wp_update_comment( 48 50 array( 49 51 'comment_ID' => $comments[0], … … 52 54 ); 53 55 $this->assertEquals( 1, $result ); 56 54 57 $comment = get_comment( $comments[0] ); 55 58 $this->assertEquals( $comments[1], $comment->comment_parent ); 59 56 60 $result = wp_update_comment( 57 61 array( … … 61 65 ); 62 66 $this->assertEquals( 0, $result ); 63 $result = wp_update_comment( 67 68 $result = wp_update_comment( 64 69 array( 65 70 'comment_ID' => $comments[0], … … 67 72 ) 68 73 ); 74 69 75 $comment = get_comment( $comments[0] ); 70 76 $this->assertEquals( $post2->ID, $comment->comment_post_ID ); … … 93 99 public function test_wp_update_comment_updates_comment_meta() { 94 100 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) ); 101 95 102 wp_update_comment( 96 103 array( … … 102 109 ) 103 110 ); 111 104 112 $this->assertEquals( 'fire', get_comment_meta( $comment_id, 'sauce', true ) ); 105 113 } … … 141 149 $comment = get_comment( $comment_id ); 142 150 $this->assertEquals( $updated_comment_text, $comment->comment_content ); 151 } 152 153 /** 154 * @ticket 39732 155 */ 156 public function test_wp_update_comment_returns_false_for_invalid_comment_or_post_id() { 157 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) ); 158 159 $update = wp_update_comment( 160 array( 161 'comment_ID' => -1, 162 'comment_post_ID' => self::$post_id, 163 ) 164 ); 165 $this->assertSame( false, $update ); 166 167 $update = wp_update_comment( 168 array( 169 'comment_ID' => $comment_id, 170 'comment_post_ID' => -1, 171 ) 172 ); 173 $this->assertSame( false, $update ); 143 174 } 144 175
Note: See TracChangeset
for help on using the changeset viewer.