|
@@ 80-90 (lines=11) @@
|
| 77 |
|
/** |
| 78 |
|
* @ticket 34954 |
| 79 |
|
*/ |
| 80 |
|
function test_wp_update_comment_with_no_post_id() |
| 81 |
|
{ |
| 82 |
|
$comment_id = self::factory()->comment->create(array( 'comment_post_ID' => 0 )); |
| 83 |
|
|
| 84 |
|
$updated_comment_text = 'I should be able to update a comment with a Post ID of zero'; |
| 85 |
|
|
| 86 |
|
$update = wp_update_comment(array( 'comment_ID' => $comment_id, 'comment_content' => $updated_comment_text, 'comment_post_ID' => 0 )); |
| 87 |
|
$this->assertSame(1, $update); |
| 88 |
|
|
| 89 |
|
$comment = get_comment($comment_id); |
| 90 |
|
$this->assertEquals($updated_comment_text, $comment->comment_content); |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
public function test_get_approved_comments() |
|
@@ 776-792 (lines=17) @@
|
| 773 |
|
} |
| 774 |
|
} |
| 775 |
|
|
| 776 |
|
public function test_update_should_invalidate_comment_cache() |
| 777 |
|
{ |
| 778 |
|
global $wpdb; |
| 779 |
|
|
| 780 |
|
$c = self::factory()->comment->create(array( 'comment_author' => 'Foo' )); |
| 781 |
|
|
| 782 |
|
$comment = get_comment($c); |
| 783 |
|
$this->assertSame('Foo', $comment->comment_author); |
| 784 |
|
|
| 785 |
|
wp_update_comment( |
| 786 |
|
array( |
| 787 |
|
'comment_ID' => $c, |
| 788 |
|
'comment_author' => 'Bar', |
| 789 |
|
) |
| 790 |
|
); |
| 791 |
|
|
| 792 |
|
$comment = get_comment($c); |
| 793 |
|
|
| 794 |
|
$this->assertSame('Bar', $comment->comment_author); |
| 795 |
|
} |