From 368ea6bfc5d64d61de1a3b0e028a52284cb55170 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 26 Mar 2019 23:52:03 +0000 Subject: [PATCH] Build/Test Tools: Display an error message with a recommendation to run `grunt build` when trying to run WordPress core tests without the `/build/` directory. Props davidbaumwald. Fixes #46593. git-svn-id: https://develop.svn.wordpress.org/trunk@45020 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/includes/bootstrap.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/phpunit/includes/bootstrap.php b/tests/phpunit/includes/bootstrap.php index 0390d62312..23faca64e5 100644 --- a/tests/phpunit/includes/bootstrap.php +++ b/tests/phpunit/includes/bootstrap.php @@ -33,6 +33,7 @@ if ( ! is_readable( $config_file_path ) ) { echo "ERROR: wp-tests-config.php is missing! Please use wp-tests-config-sample.php to create a config file.\n"; exit( 1 ); } + require_once $config_file_path; require_once dirname( __FILE__ ) . '/functions.php'; @@ -45,6 +46,11 @@ if ( version_compare( tests_get_phpunit_version(), '8.0', '>=' ) ) { exit( 1 ); } +if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS && ! is_dir( ABSPATH ) ) { + echo "ERROR: The /build/ directory is missing! Please run `grunt build` prior to running PHPUnit.\n"; + exit( 1 ); +} + tests_reset__SERVER(); define( 'WP_TESTS_TABLE_PREFIX', $table_prefix );