Ticket #36658: 36658.2.diff
File 36658.2.diff, 3.4 KB (added by , 8 years ago) |
---|
-
tests/phpunit/includes/mock-mailer.php
84 84 } 85 85 return $mailer; 86 86 } 87 88 89 /** 90 * Helper method to reset the phpmailer instance. 91 * 92 * @since 4.6.0 93 * 94 * @return bool 95 */ 96 function reset_php_mailer_instance() { 97 $mailer = tests_retrieve_phpmailer_instance(); 98 if ( $mailer && isset( $mailer->mock_sent ) ) { 99 unset( $mailer->mock_sent ); 100 return true; 101 } 102 103 return false; 104 } -
tests/phpunit/tests/comment.php
9 9 10 10 public function setUp() { 11 11 parent::setUp(); 12 unset( $GLOBALS['phpmailer']->mock_sent);12 reset_php_mailer_instance(); 13 13 } 14 14 15 15 public static function wpSetUpBeforeClass( $factory ) { … … 558 558 && WP_TESTS_EMAIL == $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0] 559 559 ) { 560 560 $email_sent_when_comment_added = true; 561 unset( $GLOBALS['phpmailer']->mock_sent);561 reset_php_mailer_instance(); 562 562 } else { 563 563 $email_sent_when_comment_added = false; 564 564 } … … 589 589 } else { 590 590 $email_sent_when_comment_approved = false; 591 591 } 592 unset( $GLOBALS['phpmailer']->mock_sent);592 reset_php_mailer_instance(); 593 593 594 594 // Post authors are notified when a new comment is added to their post. 595 595 $data = array( … … 607 607 ! empty( $GLOBALS['phpmailer']->mock_sent ) && 608 608 'test@test.com' == $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0] ) { 609 609 $email_sent_when_comment_added = true; 610 unset( $GLOBALS['phpmailer']->mock_sent);610 reset_php_mailer_instance(); 611 611 } else { 612 612 $email_sent_when_comment_added = false; 613 613 } -
tests/phpunit/tests/mail.php
6 6 class Tests_Mail extends WP_UnitTestCase { 7 7 function setUp() { 8 8 parent::setUp(); 9 unset( $GLOBALS['phpmailer']->mock_sent);9 reset_php_mailer_instance(); 10 10 } 11 11 12 12 function tearDown() { 13 unset( $GLOBALS['phpmailer']->mock_sent );14 13 parent::tearDown(); 14 reset_php_mailer_instance(); 15 15 } 16 16 17 17 /** -
tests/phpunit/tests/user.php
1024 1024 * @ticket 36009 1025 1025 */ 1026 1026 function test_wp_new_user_notification( $notify, $admin_email_sent_expected, $user_email_sent_expected ) { 1027 unset( $GLOBALS['phpmailer']->mock_sent);1027 reset_php_mailer_instance(); 1028 1028 1029 1029 $was_admin_email_sent = false; 1030 1030 $was_user_email_sent = false; … … 1100 1100 * @expectedDeprecated wp_new_user_notification 1101 1101 */ 1102 1102 function test_wp_new_user_notification_old_signature_throws_deprecated_warning_but_sends() { 1103 unset( $GLOBALS['phpmailer']->mock_sent);1103 reset_php_mailer_instance(); 1104 1104 1105 1105 $was_admin_email_sent = false; 1106 1106 $was_user_email_sent = false; … … 1125 1125 * @ticket 34377 1126 1126 */ 1127 1127 function test_wp_new_user_notification_old_signature_no_password() { 1128 unset( $GLOBALS['phpmailer']->mock_sent);1128 reset_php_mailer_instance(); 1129 1129 1130 1130 $was_admin_email_sent = false; 1131 1131 $was_user_email_sent = false;