Changeset 50375 for trunk/tests/phpunit/tests/comment.php
- Timestamp:
- 02/17/2021 01:06:43 PM (5 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/comment.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment.php
r50113 r50375 553 553 self::$notify_message = $notify_message; 554 554 return $notify_message; 555 }556 557 /**558 * @ticket 33717559 */560 public function test_wp_new_comment_notify_comment_author_once_only() {561 $c = self::factory()->comment->create(562 array(563 'comment_post_ID' => self::$post_id,564 'comment_approved' => '0',565 'comment_author_email' => 'foo@bar.mail',566 )567 );568 569 // The comment author subscribed to receive an email once comment is approved.570 update_comment_meta( $c, '_wp_comment_author_notification_optin', true );571 572 // For the purpose of the test we are removing this hook to directly use the function to notify the comment author.573 remove_action( 'comment_unapproved_to_approved', 'wp_new_comment_notify_comment_author' );574 575 // Approve the comment.576 wp_set_comment_status( $c, 'approve' );577 578 $sent = wp_new_comment_notify_comment_author( $c );579 $resent = wp_new_comment_notify_comment_author( $c );580 581 $this->assertTrue( $sent );582 $this->assertFalse( $resent );583 }584 585 /**586 * @ticket 33717587 */588 public function test_wp_new_comment_notify_comment_author_has_not_opted_in() {589 $c = self::factory()->comment->create(590 array(591 'comment_post_ID' => self::$post_id,592 'comment_approved' => '0',593 'comment_author_email' => 'bat@man.mail',594 )595 );596 597 // For the purpose of the test we are removing this hook to directly use the function to notify the comment author.598 remove_action( 'comment_unapproved_to_approved', 'wp_new_comment_notify_comment_author' );599 600 // Approve the comment.601 wp_set_comment_status( $c, 'approve' );602 603 $sent = wp_new_comment_notify_comment_author( $c );604 605 // The comment author hasn't subscribed to receive an email, no email should be sent.606 $this->assertFalse( $sent );607 555 } 608 556
Note: See TracChangeset
for help on using the changeset viewer.