Changeset 42343 for trunk/tests/phpunit/tests/comment/checkComment.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment/checkComment.php
r40557 r42343 35 35 36 36 public function test_should_return_true_when_comment_whitelist_is_enabled_and_author_has_approved_comment() { 37 $post_id = self::factory()->post->create();38 $prev_args = array(37 $post_id = self::factory()->post->create(); 38 $prev_args = array( 39 39 'comment_post_ID' => $post_id, 40 40 'comment_content' => 'Can we build it?', … … 59 59 60 60 // Approve the previous comment. 61 wp_update_comment( array( 62 'comment_ID' => $prev_comment_id, 63 'comment_approved' => 1, 64 ) ); 61 wp_update_comment( 62 array( 63 'comment_ID' => $prev_comment_id, 64 'comment_approved' => 1, 65 ) 66 ); 65 67 $results = check_comment( $author, $author_email, $author_url, $comment, $author_ip, $user_agent, $comment_type ); 66 68 $this->assertTrue( $results ); … … 78 80 $comment_type = ''; 79 81 80 update_option( 'moderation_keys', "foo\nbar\nscoop" );82 update_option( 'moderation_keys', "foo\nbar\nscoop" ); 81 83 $results = check_comment( $author, $author_email, $author_url, $comment, $author_ip, $user_agent, $comment_type ); 82 84 $this->assertFalse( $results ); … … 94 96 $comment_type = ''; 95 97 96 update_option( 'moderation_keys', "foo\nbar" );98 update_option( 'moderation_keys', "foo\nbar" ); 97 99 $results = check_comment( $author, $author_email, $author_url, $comment, $author_ip, $user_agent, $comment_type ); 98 100 $this->assertTrue( $results ); … … 135 137 */ 136 138 public function test_should_return_true_when_comment_whitelist_is_enabled_and_user_has_previously_approved_comments_with_different_email() { 137 $subscriber_id = $this->factory()->user->create( array( 138 'role' => 'subscriber', 139 'email' => 'sub@example.com', 140 ) ); 139 $subscriber_id = $this->factory()->user->create( 140 array( 141 'role' => 'subscriber', 142 'email' => 'sub@example.com', 143 ) 144 ); 141 145 142 146 // Make sure comment author has an approved comment. 143 $this->factory->comment->create( array( 'user_id' => $subscriber_id, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'sub@example.com' ) ); 147 $this->factory->comment->create( 148 array( 149 'user_id' => $subscriber_id, 150 'comment_approved' => '1', 151 'comment_author' => 'foo', 152 'comment_author_email' => 'sub@example.com', 153 ) 154 ); 144 155 145 $subscriber_user = new WP_User( $subscriber_id );156 $subscriber_user = new WP_User( $subscriber_id ); 146 157 $subscriber_user->user_email = 'newsub@example.com'; 147 158 … … 158 169 */ 159 170 public function test_should_return_false_when_comment_whitelist_is_enabled_and_user_does_not_have_a_previously_approved_comment_with_any_email() { 160 $subscriber_id = $this->factory()->user->create( array( 161 'role' => 'subscriber', 162 'email' => 'zig@example.com', 163 ) ); 171 $subscriber_id = $this->factory()->user->create( 172 array( 173 'role' => 'subscriber', 174 'email' => 'zig@example.com', 175 ) 176 ); 164 177 165 $subscriber_user = new WP_User( $subscriber_id );178 $subscriber_user = new WP_User( $subscriber_id ); 166 179 $subscriber_user->user_email = 'zag@example.com'; 167 180
Note: See TracChangeset
for help on using the changeset viewer.