Skip to content

Commit 631bd56

Browse files
Add a test to verify that the comments table never shows the note comment_type.
1 parent 868ef26 commit 631bd56

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

tests/phpunit/tests/admin/wpCommentsListTable.php

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,35 @@ public function test_get_views_should_return_views_by_default() {
213213
);
214214
$this->assertSame( $expected, $this->table->get_views() );
215215
}
216-
}
216+
217+
/**
218+
* Verify that the comments table never shows the note comment_type.
219+
*
220+
* @ticket 64198
221+
*/
222+
public function test_comments_list_table_does_not_show_note_comment_type() {
223+
$post_id = self::factory()->post->create();
224+
$note_id = self::factory()->comment->create(
225+
array(
226+
'comment_post_ID' => $post_id,
227+
'comment_content' => 'This is a note.',
228+
'comment_type' => 'note',
229+
'comment_approved' => '1',
230+
)
231+
);
232+
$comment_id = self::factory()->comment->create(
233+
array(
234+
'comment_post_ID' => $post_id,
235+
'comment_content' => 'This is a regular comment.',
236+
'comment_type' => '',
237+
'comment_approved' => '1',
238+
)
239+
);
240+
// Request the note comment type.
241+
$_REQUEST['comment_type'] = 'note';
242+
$this->table->prepare_items();
243+
$items = $this->table->items;
244+
$this->assertCount( 1, $items );
245+
$this->assertEquals( $comment_id, $items[0]->comment_ID );
246+
}
247+
}

0 commit comments

Comments
 (0)