Changeset 48121 for trunk/tests/phpunit/tests/comment/checkComment.php
- Timestamp:
- 06/22/2020 05:24:34 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment/checkComment.php
r46586 r48121 5 5 */ 6 6 class Tests_Comment_CheckComment extends WP_UnitTestCase { 7 public function test_should_return_true_when_comment_ whitelist_is_disabled() {7 public function test_should_return_true_when_comment_previously_approved_is_disabled() { 8 8 $author = 'BobtheBuilder'; 9 9 $author_email = 'bob@example.com'; … … 14 14 $comment_type = ''; 15 15 16 update_option( 'comment_ whitelist', 0 );16 update_option( 'comment_previously_approved', 0 ); 17 17 $results = check_comment( $author, $author_email, $author_url, $comment, $author_ip, $user_agent, $comment_type ); 18 18 $this->assertTrue( $results ); 19 19 } 20 20 21 public function test_should_return_false_when_comment_ whitelist_is_enabled_and_author_does_not_have_approved_comment() {21 public function test_should_return_false_when_comment_previously_approved_is_enabled_and_author_does_not_have_approved_comment() { 22 22 $author = 'BobtheBuilder'; 23 23 $author_email = 'bob@example.com'; … … 28 28 $comment_type = ''; 29 29 30 update_option( 'comment_ whitelist', 1 );30 update_option( 'comment_previously_approved', 1 ); 31 31 $results = check_comment( $author, $author_email, $author_url, $comment, $author_ip, $user_agent, $comment_type ); 32 32 $this->assertFalse( $results ); … … 34 34 } 35 35 36 public function test_should_return_true_when_comment_ whitelist_is_enabled_and_author_has_approved_comment() {36 public function test_should_return_true_when_comment_previously_approved_is_enabled_and_author_has_approved_comment() { 37 37 $post_id = self::factory()->post->create(); 38 38 $prev_args = array( … … 45 45 $prev_comment_id = self::factory()->comment->create( $prev_args ); 46 46 47 update_option( 'comment_ whitelist', 1 );47 update_option( 'comment_previously_approved', 1 ); 48 48 49 49 $author = 'BobtheBuilder'; … … 70 70 71 71 public function test_should_return_false_when_content_matches_moderation_key() { 72 update_option( 'comment_ whitelist', 0 );72 update_option( 'comment_previously_approved', 0 ); 73 73 74 74 $author = 'WendytheBuilder'; … … 86 86 87 87 public function test_should_return_true_when_content_does_not_match_moderation_keys() { 88 update_option( 'comment_ whitelist', 0 );88 update_option( 'comment_previously_approved', 0 ); 89 89 90 90 $author = 'WendytheBuilder'; … … 102 102 103 103 public function test_should_return_false_when_link_count_exceeds_comment_max_length_setting() { 104 update_option( 'comment_ whitelist', 0 );104 update_option( 'comment_previously_approved', 0 ); 105 105 106 106 $author = 'BobtheBuilder'; … … 118 118 119 119 public function test_should_return_true_when_link_count_does_not_exceed_comment_max_length_setting() { 120 update_option( 'comment_ whitelist', 0 );120 update_option( 'comment_previously_approved', 0 ); 121 121 122 122 $author = 'BobtheBuilder'; … … 136 136 * @ticket 28603 137 137 */ 138 public function test_should_return_true_when_comment_ whitelist_is_enabled_and_user_has_previously_approved_comments_with_different_email() {138 public function test_should_return_true_when_comment_previously_approved_is_enabled_and_user_has_previously_approved_comments_with_different_email() { 139 139 $subscriber_id = $this->factory()->user->create( 140 140 array( … … 159 159 wp_update_user( $subscriber_user ); 160 160 161 update_option( 'comment_ whitelist', 1 );161 update_option( 'comment_previously_approved', 1 ); 162 162 163 163 $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 ); … … 168 168 * @ticket 28603 169 169 */ 170 public function test_should_return_false_when_comment_ whitelist_is_enabled_and_user_does_not_have_a_previously_approved_comment_with_any_email() {170 public function test_should_return_false_when_comment_previously_approved_is_enabled_and_user_does_not_have_a_previously_approved_comment_with_any_email() { 171 171 $subscriber_id = $this->factory()->user->create( 172 172 array( … … 181 181 wp_update_user( $subscriber_user ); 182 182 183 update_option( 'comment_ whitelist', 1 );183 update_option( 'comment_previously_approved', 1 ); 184 184 185 185 $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 );
Note: See TracChangeset
for help on using the changeset viewer.