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/tests/comment.php

    r36515 r37358  
    1010    public function setUp() { 
    1111        parent::setUp(); 
    12         unset( $GLOBALS['phpmailer']->mock_sent ); 
     12        reset_phpmailer_instance(); 
    1313    } 
    1414 
     
    559559        ) { 
    560560            $email_sent_when_comment_added = true; 
    561             unset( $GLOBALS['phpmailer']->mock_sent ); 
     561            reset_phpmailer_instance(); 
    562562        } else { 
    563563            $email_sent_when_comment_added = false; 
     
    590590            $email_sent_when_comment_approved = false; 
    591591        } 
    592         unset( $GLOBALS['phpmailer']->mock_sent ); 
     592        reset_phpmailer_instance(); 
    593593 
    594594        // Post authors are notified when a new comment is added to their post. 
     
    608608             'test@test.com' == $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0] ) { 
    609609            $email_sent_when_comment_added = true; 
    610             unset( $GLOBALS['phpmailer']->mock_sent ); 
     610            reset_phpmailer_instance(); 
    611611        } else { 
    612612            $email_sent_when_comment_added = false; 
Note: See TracChangeset for help on using the changeset viewer.