WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/04/16 03:48:46 (19 months ago)
Author:
boonebgorges
Message:

Tests: Introduce reset_phpmailer_instance() function.

This function provides a more convenient method for resetting the
PHPMailer instance than the previous technique of reaching into the global.

Props welcher.
Fixes #36658.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/mock-mailer.php

    r36594 r37358  
    8585    return $mailer; 
    8686} 
     87 
     88/** 
     89 * Helper method to reset the phpmailer instance. 
     90 * 
     91 * @since 4.6.0 
     92 * 
     93 * @return bool 
     94 */ 
     95function 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} 
Note: See TracChangeset for help on using the changeset viewer.