From 1e88432e34a5c8405c75e5a56977362766b4cf95 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 16 Jun 2018 14:21:18 +0000 Subject: [PATCH] Build/Test Tools: Introduce support for a `WP_TESTS_CONFIG_FILE_PATH` constant to override the test suite config file location. This can be used in phpunit.xml: {{{ }}} Props clarinetlord Fixes #39734 git-svn-id: https://develop.svn.wordpress.org/trunk@43369 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/includes/bootstrap.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/phpunit/includes/bootstrap.php b/tests/phpunit/includes/bootstrap.php index 3ea8eb6636..0d3bd4be96 100644 --- a/tests/phpunit/includes/bootstrap.php +++ b/tests/phpunit/includes/bootstrap.php @@ -10,14 +10,18 @@ if ( class_exists( 'PHPUnit\Runner\Version' ) ) { require_once dirname( __FILE__ ) . '/phpunit6-compat.php'; } -$config_file_path = dirname( dirname( __FILE__ ) ); -if ( ! file_exists( $config_file_path . '/wp-tests-config.php' ) ) { - // Support the config file from the root of the develop repository. - if ( basename( $config_file_path ) === 'phpunit' && basename( dirname( $config_file_path ) ) === 'tests' ) { - $config_file_path = dirname( dirname( $config_file_path ) ); +if ( defined( 'WP_TESTS_CONFIG_FILE_PATH' ) ) { + $config_file_path = WP_TESTS_CONFIG_FILE_PATH; +} else { + $config_file_path = dirname( dirname( __FILE__ ) ); + if ( ! file_exists( $config_file_path . '/wp-tests-config.php' ) ) { + // Support the config file from the root of the develop repository. + if ( basename( $config_file_path ) === 'phpunit' && basename( dirname( $config_file_path ) ) === 'tests' ) { + $config_file_path = dirname( dirname( $config_file_path ) ); + } } + $config_file_path .= '/wp-tests-config.php'; } -$config_file_path .= '/wp-tests-config.php'; /* * Globalize some WordPress variables, because PHPUnit loads this file inside a function