WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/25/2016 09:59:56 PM (5 years ago)
Author:
johnbillion
Message:

Unify the initialisation of $_SERVER variables during test bootstrap. This abstracts the (re-)initialisation into a function that can be used inside of tests too, before assertions are performed.

See #35954

File:
1 edited

Legend:

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

    r36563 r36715  
    2323}
    2424require_once $config_file_path;
     25require_once dirname( __FILE__ ) . '/functions.php';
     26
     27tests_reset_SERVER();
    2528
    2629define( 'WP_TESTS_TABLE_PREFIX', $table_prefix );
     
    3740define( 'WP_MEMORY_LIMIT', -1 );
    3841define( 'WP_MAX_MEMORY_LIMIT', -1 );
    39 
    40 $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
    41 $_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN;
    42 $_SERVER['SERVER_NAME'] = WP_TESTS_DOMAIN;
    43 $_SERVER['REQUEST_METHOD'] = 'GET';
    44 $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
    4542
    4643$PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
     
    6865}
    6966unset( $multisite );
    70 
    71 require_once dirname( __FILE__ ) . '/functions.php';
    7267
    7368$GLOBALS['_wp_die_disabled'] = false;
Note: See TracChangeset for help on using the changeset viewer.