Changeset 54489 for trunk/tests/phpunit/tests/comment.php
- Timestamp:
- 10/11/2022 04:30:40 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment.php
r54090 r54489 9 9 protected static $notify_message = ''; 10 10 11 protected $preprocess_comment_data = array(); 12 11 13 public function set_up() { 12 14 parent::set_up(); … … 455 457 456 458 $this->assertSame( strlen( $comment->comment_content ), 65535 ); 459 } 460 461 /** 462 * @ticket 56244 463 */ 464 public function test_wp_new_comment_sends_all_expected_parameters_to_preprocess_comment_filter() { 465 $user = get_userdata( self::$user_id ); 466 wp_set_current_user( $user->ID ); 467 468 $data = array( 469 'comment_post_ID' => self::$post_id, 470 'comment_author' => $user->display_name, 471 'comment_author_email' => $user->user_email, 472 'comment_author_url' => $user->user_url, 473 'comment_content' => 'Comment', 474 'comment_type' => '', 475 'comment_parent' => 0, 476 'user_id' => $user->ID, 477 ); 478 479 add_filter( 'preprocess_comment', array( $this, 'filter_preprocess_comment' ) ); 480 481 $comment = wp_new_comment( $data ); 482 483 $this->assertNotWPError( $comment ); 484 $this->assertSameSetsWithIndex( 485 array( 486 'comment_post_ID' => self::$post_id, 487 'comment_author' => $user->display_name, 488 'comment_author_email' => $user->user_email, 489 'comment_author_url' => $user->user_url, 490 'comment_content' => $data['comment_content'], 491 'comment_type' => '', 492 'comment_parent' => 0, 493 'user_ID' => $user->ID, 494 'user_id' => $user->ID, 495 'comment_author_IP' => '127.0.0.1', 496 'comment_agent' => '', 497 ), 498 $this->preprocess_comment_data 499 ); 500 501 } 502 503 public function filter_preprocess_comment( $commentdata ) { 504 $this->preprocess_comment_data = $commentdata; 505 return $commentdata; 457 506 } 458 507
Note: See TracChangeset
for help on using the changeset viewer.