From 0a346a22ba4fa568537975c54d5e5810896d603c Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 12 Dec 2021 15:46:46 +0000 Subject: [PATCH] Build/Test Tools: Disable WP Cron when installing PHPUnit tests. During the WordPress installation process when running the test suite, an HTTP request was always fired by a cron task and failed, because tests are run in CLI mode only. To avoid that, the `DISABLE_WP_CRON` constant was previously added to the `bootstrap.php` file. However, the constant is not passed to the `install.php` script. This commit makes a similar change to `install.php`. Follow-up to [760/tests], [872/tests]. Props Chouby. Fixes #54612. git-svn-id: https://develop.svn.wordpress.org/trunk@52359 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/includes/install.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/phpunit/includes/install.php b/tests/phpunit/includes/install.php index 8ce307818d..723206d7df 100644 --- a/tests/phpunit/includes/install.php +++ b/tests/phpunit/includes/install.php @@ -14,6 +14,13 @@ if ( ! defined( 'WP_RUN_CORE_TESTS' ) && in_array( 'run_core_tests', $argv, true } define( 'WP_INSTALLING', true ); + +/* + * Cron tries to make an HTTP request to the site, which always fails, + * because tests are run in CLI mode only. + */ +define( 'DISABLE_WP_CRON', true ); + require_once $config_file_path; require_once __DIR__ . '/functions.php';