Changeset 37358
- Timestamp:
- 05/04/2016 03:48:46 AM (9 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/mock-mailer.php
r36594 r37358 85 85 return $mailer; 86 86 } 87 88 /** 89 * Helper method to reset the phpmailer instance. 90 * 91 * @since 4.6.0 92 * 93 * @return bool 94 */ 95 function reset_phpmailer_instance() { 96 $mailer = tests_retrieve_phpmailer_instance(); 97 if ( $mailer && isset( $mailer->mock_sent ) ) { 98 unset( $mailer->mock_sent ); 99 return true; 100 } 101 102 return false; 103 } -
trunk/tests/phpunit/tests/comment.php
r36515 r37358 10 10 public function setUp() { 11 11 parent::setUp(); 12 unset( $GLOBALS['phpmailer']->mock_sent);12 reset_phpmailer_instance(); 13 13 } 14 14 … … 559 559 ) { 560 560 $email_sent_when_comment_added = true; 561 unset( $GLOBALS['phpmailer']->mock_sent);561 reset_phpmailer_instance(); 562 562 } else { 563 563 $email_sent_when_comment_added = false; … … 590 590 $email_sent_when_comment_approved = false; 591 591 } 592 unset( $GLOBALS['phpmailer']->mock_sent);592 reset_phpmailer_instance(); 593 593 594 594 // Post authors are notified when a new comment is added to their post. … … 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_phpmailer_instance(); 611 611 } else { 612 612 $email_sent_when_comment_added = false; -
trunk/tests/phpunit/tests/mail.php
r37307 r37358 7 7 function setUp() { 8 8 parent::setUp(); 9 unset( $GLOBALS['phpmailer']->mock_sent);9 reset_phpmailer_instance(); 10 10 } 11 11 12 12 function tearDown() { 13 unset( $GLOBALS['phpmailer']->mock_sent);13 reset_phpmailer_instance(); 14 14 parent::tearDown(); 15 15 } -
trunk/tests/phpunit/tests/user.php
r37277 r37358 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_phpmailer_instance(); 1028 1028 1029 1029 $was_admin_email_sent = false; … … 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_phpmailer_instance(); 1104 1104 1105 1105 $was_admin_email_sent = false; … … 1126 1126 */ 1127 1127 function test_wp_new_user_notification_old_signature_no_password() { 1128 unset( $GLOBALS['phpmailer']->mock_sent);1128 reset_phpmailer_instance(); 1129 1129 1130 1130 $was_admin_email_sent = false;
Note: See TracChangeset
for help on using the changeset viewer.