Make WordPress Core


Ignore:
Timestamp:
10/21/2015 11:51:45 PM (10 years ago)
Author:
johnbillion
Message:

Initialise $_SERVER['SERVER_NAME'] during the test bootstrap to avoid individual tests having to do it.

Fixes #34394

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase.php

    r35309 r35350  
    111111        $this->expectDeprecated();
    112112        add_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) );
    113 
    114         add_filter( 'wp_mail', array( $this, 'set_wp_mail_globals' ) );
    115113    }
    116114
     
    670668
    671669    /**
    672      * When `wp_mail()` is called, make sure `$_SERVER['SERVER_NAME']` is faked.
    673      *
    674      * @since 4.3.0
    675      *
    676      * @param array $args `wp_mail()` arguments.
    677      * @return array $args
    678      */
    679     public function set_wp_mail_globals( $args ) {
    680         if ( ! isset( $_SERVER['SERVER_NAME'] ) ) {
    681             $_SERVER['SERVER_NAME'] = 'example.com';
    682             add_action( 'phpmailer_init', array( $this, 'tear_down_wp_mail_globals' ) );
    683         }
    684 
    685         return $args;
    686     }
    687 
    688     /**
    689      * Tear down the faked `$_SERVER['SERVER_NAME']` global used in `wp_mail()`.
    690      *
    691      * @since 4.3.0
    692      */
    693     public function tear_down_wp_mail_globals() {
    694         unset( $_SERVER['SERVER_NAME'] );
    695     }
    696 
    697     /**
    698670     * Multisite-agnostic way to delete a user from the database.
    699671     *
Note: See TracChangeset for help on using the changeset viewer.