wp-cli / wp-config-transformer

Programmatically edit a wp-config.php file
MIT License
81 stars 25 forks source link

Cannot install phpunit on PHP version 8.0.7 #32

Closed ryotsun closed 1 year ago

ryotsun commented 3 years ago

Bug Report

Encountered an error when I ran composer install I encountered the following error when I tried package installation.

% composer install
No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpunit/phpunit[6.5.5, ..., 6.5.14] require php ^7.0 -> your php version (8.0.7) does not satisfy that requirement.
    - phpunit/phpunit[7.0.0, ..., 7.5.20] require php ^7.1 -> your php version (8.0.7) does not satisfy that requirement.
    - Root composer.json requires phpunit/phpunit ^6.5.5 || ^7.0.0 -> satisfiable by phpunit/phpunit[6.5.5, ..., 6.5.14, 7.0.0, ..., 7.5.20].

Environment

% wp --info
OS: Darwin 20.5.0 Darwin Kernel Version 20.5.0: Sat May  8 05:10:31 PDT 2021; root:xnu-7195.121.3~9/RELEASE_ARM64_T8101 x86_64
Shell:  /bin/zsh
PHP binary: /usr/local/bin/php
PHP version:    8.0.7
php.ini used:   /usr/local/etc/php/8.0/php.ini
MySQL binary:   /usr/local/opt/mysql@5.7/bin/mysql
MySQL version:  mysql  Ver 14.14 Distrib 5.7.34, for osx10.16 (x86_64) using  EditLine wrapper
SQL modes:  
WP-CLI root dir:    /Users/xxx/wp-cli
WP-CLI vendor dir:  /Users/xxx/wp-cli/vendor
WP_CLI phar path:   
WP-CLI packages dir:    /Users/xxx/.wp-cli/packages/
WP-CLI global config:   
WP-CLI project config:  
WP-CLI version: 2.6.0-alpha

Possible solution Adopt version of phpunit suitable for PHP 8 and above.

diff --git a/composer.json b/composer.json
index 7540d42..2685743 100644
--- a/composer.json
+++ b/composer.json
@@ -14,7 +14,7 @@
     },
     "require-dev": {
         "composer/composer": ">=1.5.6 <1.7.0 || ^1.7.1 || ^2.0.0",
-        "phpunit/phpunit": "^6.5.5 || ^7.0.0",
+        "phpunit/phpunit": "^6.5.5 || ^7.0.0 || ^8.0.0",
         "wp-coding-standards/wpcs": "^0.14.0 || ^1.0.0 || ^2.0.0"
     },
     "autoload": {
swissspidy commented 1 year ago

This does not appear to be an issue (anymore), as the PHPUnit dependency is handled via wp-cli/wp-cli-tests -> yoast/phpunit-polyfills, which will install the right PHPUnit version depending on the PHP version.

I'm closing this for now, but feel free to reopen if there's still an issue with installing dependencies.