Changeset 38738 for trunk/tests/phpunit/tests/comment/checkComment.php
- Timestamp:
- 10/06/2016 03:50:55 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment/checkComment.php
r38114 r38738 128 128 $this->assertTrue( $results ); 129 129 } 130 131 /** 132 * @ticket 28603 133 */ 134 public function test_should_return_true_when_comment_whitelist_is_enabled_and_user_has_previously_approved_comments_with_different_email() { 135 $subscriber_id = $this->factory()->user->create( array( 136 'role' => 'subscriber', 137 'email' => 'sub@example.com', 138 ) ); 139 140 // Make sure comment author has an approved comment. 141 $this->factory->comment->create( array( 'user_id' => $subscriber_id, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'sub@example.com' ) ); 142 143 $subscriber_user = new WP_User( $subscriber_id ); 144 $subscriber_user->user_email = 'newsub@example.com'; 145 146 wp_update_user( $subscriber_user ); 147 148 update_option( 'comment_whitelist', 1 ); 149 150 $results = check_comment( 'foo', 'newsub@example.com', 'http://example.com', 'This is a comment.', '66.155.40.249', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:35.0) Gecko/20100101 Firefox/35.0', 'comment', 4 ); 151 $this->assertTrue( $results ); 152 } 153 154 /** 155 * @ticket 28603 156 */ 157 public function test_should_return_false_when_comment_whitelist_is_enabled_and_user_does_not_have_a_previously_approved_comment_with_any_email() { 158 $subscriber_id = $this->factory()->user->create( array( 159 'role' => 'subscriber', 160 'email' => 'zig@example.com', 161 ) ); 162 163 $subscriber_user = new WP_User( $subscriber_id ); 164 $subscriber_user->user_email = 'zag@example.com'; 165 166 wp_update_user( $subscriber_user ); 167 168 update_option( 'comment_whitelist', 1 ); 169 170 $results = check_comment( 'bar', 'zag@example.com', 'http://example.com', 'This is my first comment.', '66.155.40.249', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:35.0) Gecko/20100101 Firefox/35.0', 'comment', 4 ); 171 $this->assertFalse( $results ); 172 } 130 173 }
Note: See TracChangeset
for help on using the changeset viewer.