Skip to:
Content

BuddyPress.org

Changeset 8415


Ignore:
Timestamp:
05/12/2014 08:02:21 PM (10 years ago)
Author:
boonebgorges
Message:

Rework the way that the WP tests directory is inferred during test bootstrap, to support WP_DEVELOP_DIR

This provides greater flexibility, and better compatibility with other projects.

Fixes #5376

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/define-constants.php

    r8376 r8415  
    1212
    1313/**
    14  * In the pre-develop.svn WP development environment, an environmental bash
    15  * variable would be set to run PHP Unit tests. However, this has been done
    16  * away with in a post-develop.svn world. We'll still check if this variable
    17  * is set for backwards compat.
     14 * Determine where the WP test suite lives. Three options are supported:
     15 *
     16 * - Define a WP_DEVELOP_DIR environment variable, which points to a checkout
     17 *   of the develop.svn.wordpress.org repository (this is recommended)
     18 * - Define a WP_TESTS_DIR environment variable, which points to a checkout of
     19 *   WordPress test suite
     20 * - Assume that we are inside of a develop.svn.wordpress.org setup, and walk
     21 *   up the directory tree
    1822 */
    19 if ( getenv( 'WP_TESTS_DIR' ) ) {
     23if ( false !== getenv( 'WP_TESTS_DIR' ) ) {
    2024    define( 'WP_TESTS_DIR', getenv( 'WP_TESTS_DIR' ) );
    2125    define( 'WP_ROOT_DIR', WP_TESTS_DIR );
    2226} else {
    23     define( 'WP_ROOT_DIR', dirname( dirname( dirname( dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) ) ) ) );
     27    // Support WP_DEVELOP_DIR, as used by some plugins
     28    if ( false !== getenv( 'WP_DEVELOP_DIR' ) ) {
     29        define( 'WP_TESTS_DIR', getenv( 'WP_DEVELOP_DIR' ) );
     30    } else {
     31        define( 'WP_ROOT_DIR', dirname( dirname( dirname( dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) ) ) ) );
     32    }
     33
    2434    define( 'WP_TESTS_DIR', WP_ROOT_DIR . '/tests/phpunit' );
    2535}
Note: See TracChangeset for help on using the changeset viewer.