1
0
Fork 0
mirror of https://github.com/buddypress/buddypress.git synced 2026-07-22 20:56:55 +08:00
buddypress/tests/phpunit/includes/define-constants.php
Mathieu Viet 9bd0d0aa69 Update wp-env to version 9.0.0 & adapt the PHPUnit tests suite to it
- Update PHPUnit related npm scripts for `wp-env` 9.0.0.
- Create `test_multi`: a new composer script to run Multisite Unit tests.
- Remove our composer dependency to `wp-phpunit/wp-phpunit`.
- Update the PHPUnit tests suite so that it stops using `wp-phpunit/wp-phpunit` when it's within the `wp-env` context.
- Remove no more used PHPUnit specific configuration files.

Fixes #9053
Closes https://github.com/buddypress/buddypress/pull/211



git-svn-id: https://buddypress.svn.wordpress.org/trunk@13720 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
2024-01-31 20:09:06 +00:00

55 lines
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_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" );
}
}