Changeset 47626
- Timestamp:
- 04/26/2020 01:42:03 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment.php
r47617 r47626 1913 1913 $comment_approved = ! isset( $data['comment_approved'] ) ? 1 : $data['comment_approved']; 1914 1914 $comment_agent = ! isset( $data['comment_agent'] ) ? '' : $data['comment_agent']; 1915 $comment_type = ! isset( $data['comment_type'] ) ? 'comment' : $data['comment_type'];1915 $comment_type = empty( $data['comment_type'] ) ? 'comment' : $data['comment_type']; 1916 1916 $comment_parent = ! isset( $data['comment_parent'] ) ? 0 : $data['comment_parent']; 1917 1917 -
trunk/tests/phpunit/tests/comment-submission.php
r47597 r47626 714 714 $this->assertWPError( $comment ); 715 715 $this->assertSame( $error, $comment->get_error_code() ); 716 } 717 718 /** 719 * @ticket 49236 720 */ 721 public function test_submitting_comment_with_empty_type_results_in_correct_type() { 722 $data = array( 723 'comment_post_ID' => self::$post->ID, 724 'comment' => 'Comment', 725 'author' => 'Comment Author', 726 'email' => 'comment@example.org', 727 'comment_type' => '', 728 ); 729 $comment = wp_handle_comment_submission( $data ); 730 731 $this->assertNotWPError( $comment ); 732 $this->assertInstanceOf( 'WP_Comment', $comment ); 733 734 $this->assertSame( 'comment', $comment->comment_type ); 735 } 736 737 /** 738 * @ticket 49236 739 */ 740 public function test_inserting_comment_with_empty_type_results_in_correct_type() { 741 $data = array( 742 'comment_post_ID' => self::$post->ID, 743 'comment' => 'Comment', 744 'author' => 'Comment Author', 745 'email' => 'comment@example.org', 746 'comment_type' => '', 747 ); 748 $comment_id = wp_insert_comment( $data ); 749 $comment = get_comment( $comment_id ); 750 751 $this->assertNotWPError( $comment ); 752 $this->assertInstanceOf( 'WP_Comment', $comment ); 753 754 $this->assertSame( 'comment', $comment->comment_type ); 716 755 } 717 756
Note: See TracChangeset
for help on using the changeset viewer.