1
0
Fork 0
mirror of https://github.com/buddypress/buddypress.git synced 2026-07-23 21:06:56 +08:00
buddypress/tests/phpunit/includes/define-constants.php
Mathieu Viet c2bc79d99c Use the PHPUnit Composer dependency to run Travis tests
- Adds version 5.7 to the WordPress matrix
- Only run tests about PHP 5.6 with WP 4.9

See #8381


git-svn-id: https://buddypress.svn.wordpress.org/trunk@12853 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
2021-03-01 20:23:16 +00:00

58 lines
2.2 KiB
PHP

<?php
/**
* Define constants needed by test suite.
*/
define( 'BP_PLUGIN_DIR', dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/src/' );
if ( ! defined( 'BP_TESTS_DIR' ) ) {
define( 'BP_TESTS_DIR', dirname( dirname( __FILE__ ) ) . '/' );
}
/**
* Determine where the WP test suite lives. Three options are supported:
*
* - Define a WP_DEVELOP_DIR environment variable, which points to a checkout
* of the develop.svn.wordpress.org repository (this is recommended)
* - Define a WP_TESTS_DIR environment variable, which points to a checkout of
* WordPress test suite
* - Assume that we are inside of a develop.svn.wordpress.org setup, and walk
* up the directory tree
*/
if ( false !== getenv( 'WP_PHPUNIT__DIR' ) && defined( 'BP_USE_WP_ENV_TESTS' ) ) {
define( 'WP_TESTS_DIR', getenv( 'WP_PHPUNIT__DIR' ) );
define( 'WP_ROOT_DIR', '/var/www/html' );
} elseif ( false !== getenv( 'WP_TESTS_DIR' ) ) {
define( 'WP_TESTS_DIR', getenv( 'WP_TESTS_DIR' ) );
define( 'WP_ROOT_DIR', WP_TESTS_DIR );
} else {
// Support WP_DEVELOP_DIR, as used by some plugins
if ( false !== getenv( 'WP_DEVELOP_DIR' ) ) {
define( 'WP_ROOT_DIR', getenv( 'WP_DEVELOP_DIR' ) );
} else {
define( 'WP_ROOT_DIR', dirname( dirname( dirname( dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ) ) ) ) );
}
define( 'WP_TESTS_DIR', WP_ROOT_DIR . '/tests/phpunit' );
}
if ( ! defined( 'WP_TESTS_CONFIG_FILE_PATH' ) ) {
// Based on the tests directory, look for a config file
if ( file_exists( WP_ROOT_DIR . '/wp-tests-config.php' ) ) {
// Standard develop.svn.wordpress.org setup
define( 'WP_TESTS_CONFIG_PATH', WP_ROOT_DIR . '/wp-tests-config.php' );
} elseif ( file_exists( WP_TESTS_DIR . '/wp-tests-config.php' ) ) {
// Legacy unit-test.svn.wordpress.org setup
define( 'WP_TESTS_CONFIG_PATH', WP_TESTS_DIR . '/wp-tests-config.php' );
} elseif ( file_exists( dirname( dirname( WP_TESTS_DIR ) ) . '/wp-tests-config.php' ) ) {
// Environment variable exists and points to tests/phpunit of
// develop.svn.wordpress.org setup
define( 'WP_TESTS_CONFIG_PATH', dirname( dirname( WP_TESTS_DIR ) ) . '/wp-tests-config.php' );
} else {
die( "wp-tests-config.php could not be found.\n" );
}
}