WordPress.org

Make WordPress Core

Ticket #39734: Add_optional_constant_to_preset_tests_config_file.patch

File Add_optional_constant_to_preset_tests_config_file.patch, 2.4 KB (added by clarinetlord, 3 years ago)
  • tests/phpunit/includes/bootstrap.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    33 * Installs WordPress for running the tests and loads WordPress and the test libraries
    44 */
    55
    6 
    7 $config_file_path = dirname( dirname( __FILE__ ) );
    8 if ( ! file_exists( $config_file_path . '/wp-tests-config.php' ) ) {
    9         // Support the config file from the root of the develop repository.
    10         if ( basename( $config_file_path ) === 'phpunit' && basename( dirname( $config_file_path ) ) === 'tests' )
    11                 $config_file_path = dirname( dirname( $config_file_path ) );
     6if ( !defined( 'WP_CONFIG_FILE_PATH' ) ) {
     7    $config_file_path = dirname( dirname( __FILE__ ) );
     8    if ( ! file_exists( $config_file_path . '/wp-tests-config.php' ) ) {
     9        // Support the config file from the root of the develop repository.
     10        if ( basename( $config_file_path ) === 'phpunit' && basename( dirname( $config_file_path ) ) === 'tests' )
     11            $config_file_path = dirname( dirname( $config_file_path ) );
     12    }
     13    define( 'WP_CONFIG_FILE_PATH', $config_file_path . '/wp-tests-config.php' );
    1214}
    13 $config_file_path .= '/wp-tests-config.php';
    1415
    1516/*
    1617 * Globalize some WordPress variables, because PHPUnit loads this file inside a function
     
    1819 */
    1920global $wpdb, $current_site, $current_blog, $wp_rewrite, $shortcode_tags, $wp, $phpmailer, $wp_theme_directories;
    2021
    21 if ( ! is_readable( $config_file_path ) ) {
     22if ( ! is_readable( WP_CONFIG_FILE_PATH ) ) {
    2223        echo "ERROR: wp-tests-config.php is missing! Please use wp-tests-config-sample.php to create a config file.\n";
    2324        exit( 1 );
    2425}
    25 require_once $config_file_path;
     26require_once WP_CONFIG_FILE_PATH;
    2627require_once dirname( __FILE__ ) . '/functions.php';
    2728
    2829tests_reset__SERVER();
     
    5960}
    6061$wp_theme_directories = array( DIR_TESTDATA . '/themedir1' );
    6162
    62 system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) . '/install.php' ) . ' ' . escapeshellarg( $config_file_path ) . ' ' . $multisite );
     63system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) . '/install.php' ) . ' ' . escapeshellarg( WP_CONFIG_FILE_PATH ) . ' ' . $multisite );
    6364
    6465if ( $multisite ) {
    6566        echo "Running as multisite..." . PHP_EOL;