Changeset 35350
- Timestamp:
- 10/21/2015 11:51:45 PM (9 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/bootstrap.php
r34928 r35350 38 38 $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1'; 39 39 $_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN; 40 $_SERVER['SERVER_NAME'] = WP_TESTS_DOMAIN; 40 41 $_SERVER['REQUEST_METHOD'] = 'GET'; 41 42 $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; 43 42 44 $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php'; 43 45 -
trunk/tests/phpunit/includes/install.php
r32785 r35350 16 16 $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1'; 17 17 $_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN; 18 $_SERVER['SERVER_NAME'] = WP_TESTS_DOMAIN; 18 19 $_SERVER['REQUEST_METHOD'] = 'GET'; 20 $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; 21 19 22 $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php'; 20 23 -
trunk/tests/phpunit/includes/testcase.php
r35309 r35350 111 111 $this->expectDeprecated(); 112 112 add_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) ); 113 114 add_filter( 'wp_mail', array( $this, 'set_wp_mail_globals' ) );115 113 } 116 114 … … 670 668 671 669 /** 672 * When `wp_mail()` is called, make sure `$_SERVER['SERVER_NAME']` is faked.673 *674 * @since 4.3.0675 *676 * @param array $args `wp_mail()` arguments.677 * @return array $args678 */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.0692 */693 public function tear_down_wp_mail_globals() {694 unset( $_SERVER['SERVER_NAME'] );695 }696 697 /**698 670 * Multisite-agnostic way to delete a user from the database. 699 671 * -
trunk/tests/phpunit/tests/comment.php
r35347 r35350 381 381 public function setup_notify_comment(){ 382 382 /** 383 * Mock some server variables.384 */385 $_SERVER['SERVER_NAME'] = 'phpunit.wordpress.dev';386 $_SERVER['REMOTE_ADDR'] = '127.0.0.1';387 388 /**389 383 * Prevent flood alert from firing. 390 384 */ -
trunk/tests/phpunit/tests/mail.php
r35347 r35350 189 189 $message = "Test Message"; 190 190 $headers = "From: "; 191 $expected = "From: WordPress <wordpress@ example.com>";191 $expected = "From: WordPress <wordpress@" . WP_TESTS_DOMAIN . ">"; 192 192 193 193 wp_mail( $to, $subject, $message, $headers ); -
trunk/tests/phpunit/wp-mail-real-test.php
r25165 r35350 73 73 $headers[] = "CC: {$cc}"; 74 74 75 $_SERVER['SERVER_NAME'] = 'example.com';76 75 wp_mail( $to, $subject, $message, $headers ); 77 76
Note: See TracChangeset
for help on using the changeset viewer.