Skip to:
Content

BuddyPress.org

Changeset 7424


Ignore:
Timestamp:
10/14/2013 11:28:38 PM (13 years ago)
Author:
boonebgorges
Message:

Better backward compatibility for tests configuration

Improved support for the old WP_TESTS_DIR environment variable, in particular
when pointing this environment variable toward the new develop.svn.wordpress.org
configuration.

See #5200

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/bootstrap.php

    r7423 r7424  
    1515if ( getenv( 'WP_TESTS_DIR' ) ) {
    1616        define( 'WP_TESTS_DIR', getenv( 'WP_TESTS_DIR' ) );
    17         define( 'WP_TESTS_CONFIG_PATH', WP_TESTS_DIR . '/wp-tests-config.php' );
    18 }
    19 else {
     17        define( 'WP_ROOT_DIR', WP_TESTS_DIR );
     18} else {
    2019        define( 'WP_ROOT_DIR', dirname( dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) ) );
    2120        define( 'WP_TESTS_DIR', WP_ROOT_DIR . '/tests/phpunit' );
    22         define( 'WP_TESTS_CONFIG_PATH', WP_ROOT_DIR . '/wp-tests-config.php' );
    2321}
    2422
    25 if ( ! file_exists( WP_TESTS_DIR . '/includes/functions.php' ) )
     23// Based on the tests directory, look for a config file
     24if ( file_exists( WP_ROOT_DIR . '/wp-tests-config.php' ) ) {
     25        // Standard develop.svn.wordpress.org setup
     26        define( 'WP_TESTS_CONFIG_PATH', WP_ROOT_DIR . '/wp-tests-config.php' );
     27
     28} else if ( file_exists( WP_TESTS_DIR . '/wp-tests-config.php' ) ) {
     29        // Legacy unit-test.svn.wordpress.org setup
     30        define( 'WP_TESTS_CONFIG_PATH', WP_TESTS_DIR . '/wp-tests-config.php' );
     31
     32} else if ( file_exists( dirname( dirname( WP_TESTS_DIR ) ) . '/wp-tests-config.php' ) ) {
     33        // Environment variable exists and points to tests/phpunit of
     34        // develop.svn.wordpress.org setup
     35        define( 'WP_TESTS_CONFIG_PATH', dirname( dirname( WP_TESTS_DIR ) ) . '/wp-tests-config.php' );
     36
     37} else {
     38        die( "wp-tests-config.php could not be found.\n" );
     39}
     40
     41if ( ! file_exists( WP_TESTS_DIR . '/includes/functions.php' ) ) {
    2642        die( "The WordPress PHPUnit test suite could not be found.\n" );
     43}
    2744
    2845require_once WP_TESTS_DIR . '/includes/functions.php';
Note: See TracChangeset for help on using the changeset viewer.