| 73 | |
| 74 | /** |
| 75 | * @ticket 40319 |
| 76 | */ |
| 77 | public function test_allow_if_author_name_email_includes_apastrophe_and_is_whitelisted(){ |
| 78 | update_option( 'comment_whitelist', 1 ); |
| 79 | $this->assertSame( 1, get_option('comment_whitelist') ); |
| 80 | add_filter('comment_flood_filter', '__return_false'); |
| 81 | |
| 82 | $now = time(); |
| 83 | |
| 84 | $approved_comment = array( |
| 85 | 'comment_post_ID' => self::$post_id, |
| 86 | 'comment_approved' => '1', |
| 87 | 'comment_author' => "Teal`c’", |
| 88 | 'comment_author_email' => "teal'c@example.com", |
| 89 | 'comment_author_url' => 'http://example.com', |
| 90 | 'comment_content' => 'Yes, we can!', |
| 91 | 'comment_parent' => 0, |
| 92 | 'comment_author_IP' => '192.168.0.1', |
| 93 | 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ), |
| 94 | 'comment_agent' => 'Bobbot/2.1', |
| 95 | 'comment_type' => '' |
| 96 | ); |
| 97 | |
| 98 | $approved_comment_id = wp_insert_comment( $approved_comment ); |
| 99 | |
| 100 | $new_comment = array( |
| 101 | 'comment_post_ID' => self::$post_id, |
| 102 | 'comment_author' => "Teal\`c\’", |
| 103 | 'comment_author_email' => "teal\'c@example.com", |
| 104 | 'comment_author_url' => 'http://example.com', |
| 105 | 'comment_content' => 'Yes, we sould be able to!', |
| 106 | 'comment_parent' => 0, |
| 107 | 'comment_author_IP' => '192.168.0.1', |
| 108 | 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ), |
| 109 | 'comment_agent' => 'Bobbot/2.1', |
| 110 | 'comment_type' => '' |
| 111 | ); |
| 112 | |
| 113 | $new_comment_allowed = wp_allow_comment( $new_comment ); |
| 114 | |
| 115 | update_option( 'comment_whitelist', 0 ); |
| 116 | wp_delete_comment( $approved_comment_id, true ); |
| 117 | remove_filter('comment_flood_filter', '__return_false'); |
| 118 | |
| 119 | $this->assertSame( 1, $new_comment_allowed ); |
| 120 | } |