From f6924599262d9ffe929ef1b5a046a92aa7a95af1 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Wed, 20 Apr 2016 16:51:58 +0000 Subject: [PATCH] Tests: Allow override of `MULTISITE` and `SUBDOMAIN_INSTALL` constants Props rmccue. Fixes #36567. git-svn-id: https://develop.svn.wordpress.org/trunk@37266 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/includes/bootstrap.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/phpunit/includes/bootstrap.php b/tests/phpunit/includes/bootstrap.php index b787ed6482..6ddc3f612a 100644 --- a/tests/phpunit/includes/bootstrap.php +++ b/tests/phpunit/includes/bootstrap.php @@ -42,12 +42,10 @@ define( 'WP_MAX_MEMORY_LIMIT', -1 ); $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php'; -if ( "1" == getenv( 'WP_MULTISITE' ) || - ( defined( 'WP_TESTS_MULTISITE') && WP_TESTS_MULTISITE ) ) { - $multisite = true; -} else { - $multisite = false; -} +// Should we run in multisite mode? +$multisite = '1' == getenv( 'WP_MULTISITE' ); +$multisite = $multisite || ( defined( 'WP_TESTS_MULTISITE') && WP_TESTS_MULTISITE ); +$multisite = $multisite || ( defined( 'MULTISITE' ) && MULTISITE ); // Override the PHPMailer require_once( dirname( __FILE__ ) . '/mock-mailer.php' ); @@ -57,8 +55,8 @@ system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) . '/install.ph if ( $multisite ) { echo "Running as multisite..." . PHP_EOL; - define( 'MULTISITE', true ); - define( 'SUBDOMAIN_INSTALL', false ); + defined( 'MULTISITE' ) or define( 'MULTISITE', true ); + defined( 'SUBDOMAIN_INSTALL' ) or define( 'SUBDOMAIN_INSTALL', false ); $GLOBALS['base'] = '/'; } else { echo "Running as single site... To run multisite, use -c tests/phpunit/multisite.xml" . PHP_EOL;