From fe1f6d6e5f55a5a4e3e46b3f91fda373c540aba4 Mon Sep 17 00:00:00 2001
From: jrfnl <jrfnl@users.noreply.github.com>
Date: Mon, 20 Sep 2021 18:14:29 +0200
Subject: [PATCH] Test bootstrap: improve Composer command
`composer update` will update the direct dependencies, `composer update -W` will update the dependencies including *their* dependencies, which is the recommended course of action for WP.
---
tests/phpunit/includes/bootstrap.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/phpunit/includes/bootstrap.php b/tests/phpunit/includes/bootstrap.php
index 5d6ded0bcb..f366c8ce03 100644
|
a
|
b
|
if ( version_compare( $phpunit_version, '5.7.21', '<' ) ) { |
| 66 | 66 | * {@link https://make.wordpress.org/core/handbook/testing/automated-testing/phpunit/#test-running-workflow-options} |
| 67 | 67 | * |
| 68 | 68 | * Plugin/theme integration tests can handle this in any of the following ways: |
| 69 | | * - When using a full WP install: run `composer update` for the WP install prior to running the tests. |
| | 69 | * - When using a full WP install: run `composer update -W` for the WP install prior to running the tests. |
| 70 | 70 | * - When using a partial WP test suite install: |
| 71 | 71 | * - Add a `yoast/phpunit-polyfills` (dev) requirement to the plugin/theme's own `composer.json` file. |
| 72 | 72 | * - And then: |
| … |
… |
if ( ! class_exists( 'Yoast\PHPUnitPolyfills\Autoload' ) ) { |
| 112 | 112 | echo 'The WP_TESTS_PHPUNIT_POLYFILLS_PATH constant should contain an absolute path to the root directory' |
| 113 | 113 | . ' of the PHPUnit Polyfills library.' . PHP_EOL; |
| 114 | 114 | } elseif ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS ) { |
| 115 | | echo 'You need to run `composer update` before running the tests.' . PHP_EOL; |
| | 115 | echo 'You need to run `composer update -W` before running the tests.' . PHP_EOL; |
| 116 | 116 | echo 'Once the dependencies are installed, you can run the tests using the Composer-installed version' |
| 117 | 117 | . ' of PHPUnit or using a PHPUnit phar file, but the dependencies do need to be installed' |
| 118 | 118 | . ' whichever way the tests are run.' . PHP_EOL; |
| … |
… |
if ( ! class_exists( 'Yoast\PHPUnitPolyfills\Autoload' ) ) { |
| 123 | 123 | . ' or set the absolute path to the PHPUnit Polyfills library in a "WP_TESTS_PHPUNIT_POLYFILLS_PATH"' |
| 124 | 124 | . ' constant to allow the WP Core bootstrap to load the Polyfills.' . PHP_EOL . PHP_EOL; |
| 125 | 125 | echo 'If you are trying to run the WP Core tests, make sure to set the "WP_RUN_CORE_TESTS" constant' |
| 126 | | . ' to 1 and run `composer update` before running the tests.' . PHP_EOL; |
| | 126 | . ' to 1 and run `composer update -W` before running the tests.' . PHP_EOL; |
| 127 | 127 | echo 'Once the dependencies are installed, you can run the tests using the Composer-installed' |
| 128 | 128 | . ' version of PHPUnit or using a PHPUnit phar file, but the dependencies do need to be' |
| 129 | 129 | . ' installed whichever way the tests are run.' . PHP_EOL; |
| … |
… |
if ( class_exists( '\Yoast\PHPUnitPolyfills\Autoload' ) |
| 157 | 157 | $phpunit_polyfills_minimum_version |
| 158 | 158 | ); |
| 159 | 159 | } elseif ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS ) { |
| 160 | | echo 'Please run `composer update` to install the latest version.' . PHP_EOL; |
| | 160 | echo 'Please run `composer update -W` to install the latest version.' . PHP_EOL; |
| 161 | 161 | } |
| 162 | 162 | exit( 1 ); |
| 163 | 163 | } |