Changeset 9140 for trunk/tests/phpunit/includes/testcase.php
- Timestamp:
- 11/14/2014 02:01:22 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/testcase.php
r9139 r9140 12 12 13 13 protected $temp_has_bp_moderate = array(); 14 protected $cached_SERVER_NAME = null; 14 protected static $cached_SERVER_NAME = null; 15 16 public static function setUpBeforeClass() { 17 // Fake WP mail globals, to avoid errors 18 add_filter( 'wp_mail', array( 'BP_UnitTestCase', 'setUp_wp_mail' ) ); 19 add_filter( 'wp_mail_from', array( 'BP_UnitTestCase', 'tearDown_wp_mail' ) ); 20 } 15 21 16 22 public function setUp() { … … 30 36 } 31 37 32 // Fake WP mail globals, to avoid errors33 add_filter( 'wp_mail', array( $this, 'setUp_wp_mail' ) );34 add_filter( 'wp_mail_from', array( $this, 'tearDown_wp_mail' ) );35 38 36 39 $this->factory = new BP_UnitTest_Factory; … … 403 406 * Set up globals necessary to avoid errors when using wp_mail() 404 407 */ 405 public function setUp_wp_mail( $args ) {408 public static function setUp_wp_mail( $args ) { 406 409 if ( isset( $_SERVER['SERVER_NAME'] ) ) { 407 $this->cached_SERVER_NAME = $_SERVER['SERVER_NAME'];410 self::$cached_SERVER_NAME = $_SERVER['SERVER_NAME']; 408 411 } 409 412 … … 417 420 * Tear down globals set up in setUp_wp_mail() 418 421 */ 419 public function tearDown_wp_mail( $args ) {420 if ( ! empty( $this->cached_SERVER_NAME ) ) {421 $_SERVER['SERVER_NAME'] = $this->cached_SERVER_NAME;422 public static function tearDown_wp_mail( $args ) { 423 if ( ! empty( self::$cached_SERVER_NAME ) ) { 424 $_SERVER['SERVER_NAME'] = self::$cached_SERVER_NAME; 422 425 unset( $this->cached_SERVER_NAME ); 423 426 } else {
Note: See TracChangeset
for help on using the changeset viewer.