[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/tests/phpunit/includes/ -> define-constants.php (source)

   1  <?php
   2  
   3  /**
   4   * Define constants needed by test suite.
   5   */
   6  
   7  define( 'BP_PLUGIN_DIR', dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/src/' );
   8  
   9  if ( ! defined( 'BP_TESTS_DIR' ) ) {
  10      define( 'BP_TESTS_DIR', dirname( dirname( __FILE__ ) ) . '/' );
  11  }
  12  
  13  /**
  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
  22   */
  23  if ( false !== getenv( 'WP_TESTS_DIR' ) ) {
  24      define( 'WP_TESTS_DIR', getenv( 'WP_TESTS_DIR' ) );
  25      define( 'WP_ROOT_DIR', WP_TESTS_DIR );
  26  } else {
  27      // Support WP_DEVELOP_DIR, as used by some plugins
  28      if ( false !== getenv( 'WP_DEVELOP_DIR' ) ) {
  29          define( 'WP_ROOT_DIR', getenv( 'WP_DEVELOP_DIR' ) );
  30      } else {
  31          define( 'WP_ROOT_DIR', dirname( dirname( dirname( dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ) ) ) ) );
  32      }
  33  
  34      define( 'WP_TESTS_DIR', WP_ROOT_DIR . '/tests/phpunit' );
  35  }
  36  
  37  // Based on the tests directory, look for a config file
  38  if ( file_exists( WP_ROOT_DIR . '/wp-tests-config.php' ) ) {
  39      // Standard develop.svn.wordpress.org setup
  40      define( 'WP_TESTS_CONFIG_PATH', WP_ROOT_DIR . '/wp-tests-config.php' );
  41  
  42  } elseif ( file_exists( WP_TESTS_DIR . '/wp-tests-config.php' ) ) {
  43      // Legacy unit-test.svn.wordpress.org setup
  44      define( 'WP_TESTS_CONFIG_PATH', WP_TESTS_DIR . '/wp-tests-config.php' );
  45  
  46  } elseif ( file_exists( dirname( dirname( WP_TESTS_DIR ) ) . '/wp-tests-config.php' ) ) {
  47      // Environment variable exists and points to tests/phpunit of
  48      // develop.svn.wordpress.org setup
  49      define( 'WP_TESTS_CONFIG_PATH', dirname( dirname( WP_TESTS_DIR ) ) . '/wp-tests-config.php' );
  50  
  51  } else {
  52      die( "wp-tests-config.php could not be found.\n" );
  53  }


Generated: Wed Nov 20 01:01:38 2019 Cross-referenced by PHPXref 0.7.1