Changeset 61525
- Timestamp:
- 01/26/2026 08:26:37 AM (8 hours ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-admin/includes/class-wp-comments-list-table.php (modified) (1 diff)
-
tests/phpunit/tests/admin/wpCommentsListTable.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-comments-list-table.php
r61521 r61525 156 156 'post_id' => $post_id, 157 157 'type' => $comment_type, 158 'type__not_in' => array( 'note' ), 158 159 'orderby' => $orderby, 159 160 'order' => $order, -
trunk/tests/phpunit/tests/admin/wpCommentsListTable.php
r61183 r61525 219 219 * 220 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( 221 * @ticket 64474 222 * 223 * @dataProvider data_comment_type 224 * 225 * @param string $comment_type The comment_type parameter value to test. 226 */ 227 public function test_comments_list_table_does_not_show_note_comment_type( string $comment_type ) { 228 $post_id = self::factory()->post->create(); 229 self::factory()->comment->create( 225 230 array( 226 231 'comment_post_ID' => $post_id, … … 228 233 'comment_type' => 'note', 229 234 'comment_approved' => '1', 230 ) 231 ); 232 $comment_id = self::factory()->comment->create( 235 'comment_date' => '2024-01-01 10:00:00', 236 'comment_date_gmt' => '2024-01-01 10:00:00', 237 ) 238 ); 239 $regular_comment_id = self::factory()->comment->create( 233 240 array( 234 241 'comment_post_ID' => $post_id, … … 236 243 'comment_type' => '', 237 244 'comment_approved' => '1', 238 ) 239 ); 240 // Request the note comment type. 241 $_REQUEST['comment_type'] = 'note'; 245 'comment_date' => '2024-01-01 11:00:00', 246 'comment_date_gmt' => '2024-01-01 11:00:00', 247 ) 248 ); 249 $pingback_comment_id = self::factory()->comment->create( 250 array( 251 'comment_post_ID' => $post_id, 252 'comment_content' => 'This is a pingback comment.', 253 'comment_type' => '', 254 'comment_approved' => '1', 255 'comment_date' => '2024-01-01 12:00:00', 256 'comment_date_gmt' => '2024-01-01 12:00:00', 257 ) 258 ); 259 $_REQUEST['comment_type'] = $comment_type; 242 260 $this->table->prepare_items(); 243 261 $items = $this->table->items; 244 $this->assertCount( 1, $items ); 245 $this->assertEquals( $comment_id, $items[0]->comment_ID ); 262 $this->assertCount( 2, $items ); 263 $this->assertEquals( $pingback_comment_id, $items[0]->comment_ID ); 264 $this->assertEquals( $regular_comment_id, $items[1]->comment_ID ); 265 } 266 267 /** 268 * Data provider for test_comments_list_table_does_not_show_note_comment_type(). 269 * 270 * @return array<string, string[]> 271 */ 272 public function data_comment_type(): array { 273 return array( 274 'note type explicitly requested' => array( 'note' ), 275 'all type requested' => array( 'all' ), 276 ); 246 277 } 247 278 }
Note: See TracChangeset
for help on using the changeset viewer.