Index: tests/phpunit/includes/mock-mailer.php
===================================================================
--- tests/phpunit/includes/mock-mailer.php	(revision 37307)
+++ tests/phpunit/includes/mock-mailer.php	(working copy)
@@ -77,7 +77,7 @@
  *
  * @return object|bool
  */
-function tests_retrieve_phpmailer_instance() {
+function retrieve_phpmailer_instance() {
 	$mailer = false;
 	if ( isset( $GLOBALS['phpmailer'] ) ) {
 		$mailer = $GLOBALS['phpmailer'];
@@ -84,3 +84,21 @@
 	}
 	return $mailer;
 }
+
+
+/**
+ * Helper method to reset the phpmailer instance.
+ *
+ * @since 4.6.0
+ *
+ * @return bool
+ */
+function reset_php_mailer_instance() {
+	$mailer = retrieve_phpmailer_instance();
+	if ( $mailer && isset( $mailer->mock_sent ) ) {
+		unset( $mailer->mock_sent );
+		return true;
+	}
+
+	return false;
+}
Index: tests/phpunit/tests/comment.php
===================================================================
--- tests/phpunit/tests/comment.php	(revision 37307)
+++ tests/phpunit/tests/comment.php	(working copy)
@@ -9,7 +9,7 @@
 
 	public function setUp() {
 		parent::setUp();
-		unset( $GLOBALS['phpmailer']->mock_sent );
+		reset_php_mailer_instance();
 	}
 
 	public static function wpSetUpBeforeClass( $factory ) {
@@ -558,7 +558,7 @@
 			&& WP_TESTS_EMAIL == $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0]
 		) {
 			$email_sent_when_comment_added = true;
-			unset( $GLOBALS['phpmailer']->mock_sent );
+			reset_php_mailer_instance();
 		} else {
 			$email_sent_when_comment_added = false;
 		}
@@ -589,7 +589,7 @@
 		} else {
 			$email_sent_when_comment_approved = false;
 		}
-		unset( $GLOBALS['phpmailer']->mock_sent );
+		reset_php_mailer_instance();
 
 		// Post authors are notified when a new comment is added to their post.
 		$data = array(
@@ -607,7 +607,7 @@
 		     ! empty( $GLOBALS['phpmailer']->mock_sent ) &&
 		     'test@test.com' == $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0] ) {
 			$email_sent_when_comment_added = true;
-			unset( $GLOBALS['phpmailer']->mock_sent );
+			reset_php_mailer_instance();
 		} else {
 			$email_sent_when_comment_added = false;
 		}
Index: tests/phpunit/tests/mail.php
===================================================================
--- tests/phpunit/tests/mail.php	(revision 37307)
+++ tests/phpunit/tests/mail.php	(working copy)
@@ -6,12 +6,12 @@
 class Tests_Mail extends WP_UnitTestCase {
 	function setUp() {
 		parent::setUp();
-		unset( $GLOBALS['phpmailer']->mock_sent );
+		reset_php_mailer_instance();
 	}
 
 	function tearDown() {
-		unset( $GLOBALS['phpmailer']->mock_sent );
 		parent::tearDown();
+		reset_php_mailer_instance();
 	}
 
 	/**
@@ -78,7 +78,7 @@
 
 		wp_mail( $to, $subject, $body, $headers );
 
-		$mailer = tests_retrieve_phpmailer_instance();
+		$mailer = retrieve_phpmailer_instance();
 
 		// We need some better assertions here but these catch the failure for now.
 		$this->assertEquals( $body, $mailer->get_sent()->body );
@@ -106,7 +106,7 @@
 		// Earlier versions of PHPMailer were not touchy about the formatting of these arguments.
 
 		//retrieve the mailer instance
-		$mailer = tests_retrieve_phpmailer_instance();
+		$mailer = retrieve_phpmailer_instance();
 		$this->assertEquals( 'address@tld.com',      $mailer->get_recipient( 'to' )->address );
 		$this->assertEquals( 'Name',                 $mailer->get_recipient( 'to' )->name );
 		$this->assertEquals( 'cc@cc.com',            $mailer->get_recipient( 'cc' )->address );
@@ -128,7 +128,7 @@
 
 		// WordPress 3.2 and later correctly split the address into the two parts and send them seperately to PHPMailer
 		// Earlier versions of PHPMailer were not touchy about the formatting of these arguments.
-		$mailer = tests_retrieve_phpmailer_instance();
+		$mailer = retrieve_phpmailer_instance();
 		$this->assertEquals( 'address@tld.com',                   $mailer->get_recipient( 'to' )->address );
 		$this->assertEquals( 'Name',                              $mailer->get_recipient( 'to' )->name );
 		$this->assertEquals( 'another_address@different-tld.com', $mailer->get_recipient( 'to', 0, 1 )->address );
@@ -143,7 +143,7 @@
 
 		wp_mail( $to, $subject, $message );
 
-		$mailer = tests_retrieve_phpmailer_instance();
+		$mailer = retrieve_phpmailer_instance();
 		$this->assertEquals( 'address@tld.com',                   $mailer->get_recipient( 'to' )->address );
 		$this->assertEquals( 'another_address@different-tld.com', $mailer->get_recipient( 'to', 0, 1 )->address );
 		$this->assertEquals( $message . "\n",                     $mailer->get_sent()->body );
@@ -159,7 +159,7 @@
 
 		wp_mail( $to, $subject, $message );
 
-		$mailer = tests_retrieve_phpmailer_instance();
+		$mailer = retrieve_phpmailer_instance();
 		$this->assertEquals( 'address@tld.com', $mailer->get_recipient( 'to' )->address );
 		$this->assertEquals( $message . "\n",    $mailer->get_sent()->body );
 	}
@@ -190,7 +190,7 @@
 
 		wp_mail( $to, $subject, $message, $headers );
 
-		$mailer = tests_retrieve_phpmailer_instance();
+		$mailer = retrieve_phpmailer_instance();
 		$this->assertTrue( strpos( $mailer->get_sent()->header, $expected ) > 0 );
 	}
 
@@ -206,7 +206,7 @@
 
 		wp_mail( $to, $subject, $message, $headers );
 
-		$mailer = tests_retrieve_phpmailer_instance();
+		$mailer = retrieve_phpmailer_instance();
 		$this->assertTrue( strpos( $mailer->get_sent()->header, $expected ) > 0 );
 	}
 
@@ -222,7 +222,7 @@
 
 		wp_mail( $to, $subject, $message, $headers );
 
-		$mailer = tests_retrieve_phpmailer_instance();
+		$mailer = retrieve_phpmailer_instance();
 		$this->assertTrue( strpos( $mailer->get_sent()->header, $expected ) > 0 );
 	}
 
@@ -238,7 +238,7 @@
 
 		wp_mail( $to, $subject, $message, $headers );
 
-		$mailer = tests_retrieve_phpmailer_instance();
+		$mailer = retrieve_phpmailer_instance();
 		$this->assertTrue( strpos( $mailer->get_sent()->header, $expected ) > 0 );
 	}
 
@@ -254,7 +254,7 @@
 
 		wp_mail( $to, $subject, $message, $headers );
 
-		$mailer = tests_retrieve_phpmailer_instance();
+		$mailer = retrieve_phpmailer_instance();
 		$this->assertTrue( strpos( $mailer->get_sent()->header, $expected ) > 0 );
 	}
 
@@ -270,7 +270,7 @@
 
 		wp_mail( $to, $subject, $message, $headers );
 
-		$mailer = tests_retrieve_phpmailer_instance();
+		$mailer = retrieve_phpmailer_instance();
 		$this->assertTrue( strpos( $mailer->get_sent()->header, $expected ) > 0 );
 	}
 
Index: tests/phpunit/tests/user.php
===================================================================
--- tests/phpunit/tests/user.php	(revision 37307)
+++ tests/phpunit/tests/user.php	(working copy)
@@ -1024,7 +1024,7 @@
 	 * @ticket 36009
 	 */
 	function test_wp_new_user_notification( $notify, $admin_email_sent_expected, $user_email_sent_expected ) {
-		unset( $GLOBALS['phpmailer']->mock_sent );
+		reset_php_mailer_instance();
 
 		$was_admin_email_sent = false;
 		$was_user_email_sent = false;
@@ -1031,7 +1031,7 @@
 
 		wp_new_user_notification( self::$contrib_id, null, $notify );
 
-		$mailer = tests_retrieve_phpmailer_instance();
+		$mailer = retrieve_phpmailer_instance();
 
 		/*
 		 * Check to see if a notification email was sent to the
@@ -1100,7 +1100,7 @@
 	 * @expectedDeprecated wp_new_user_notification
 	 */
 	function test_wp_new_user_notification_old_signature_throws_deprecated_warning_but_sends() {
-		unset( $GLOBALS['phpmailer']->mock_sent );
+		reset_php_mailer_instance();
 
 		$was_admin_email_sent = false;
 		$was_user_email_sent = false;
@@ -1125,7 +1125,7 @@
 	 * @ticket 34377
 	 */
 	function test_wp_new_user_notification_old_signature_no_password() {
-		unset( $GLOBALS['phpmailer']->mock_sent );
+		reset_php_mailer_instance();
 
 		$was_admin_email_sent = false;
 		$was_user_email_sent = false;
