Just a heads up that pest will require PHPUnit 9.2.x for the near future. Please use pest/pest: ^0.2.4, to ensure composer doesn't try to load PHPUnit 9.3.x.
EDIT: Pest 0.3.0, when it is released, will support PHPUnit 9.3.x and PHP 7.3-8.0. This is still a few weeks off, though. :)
Just got caught by this.
Maybe update the installation docs (https://pestphp.com/docs/installation/) - newcomers are going to be put off by the install dependency failure. It currently gets you to add the PHPUnit dependency first, before then adding the Pest dependency - which will fail.
pest/pest: ^0.2.4
Or in other words, add "pestphp/pest": "^0.2.4", to your composer.json! 馃槈
(Sorry, might seem obvious but I was even caught out by that!)
I had the opposite problem. I was following https://pestphp.com/docs/installation/ and installed PHPUnit first and got the error when I tried to install Pest after that.
This installs phpunit 9.3 by default:
composer require phpunit/phpunit:"^9.0" --dev --update-with-dependencies
And this tries to install "pestphp/pest": "^0.2.4" which has require "phpunit/phpunit": "~9.2.0" in it's composer.json and fails
composer require pestphp/pest --dev
Had to change first step to composer require phpunit/phpunit:"~9.2.6" --dev --update-with-dependencies for it to work.
Yeh, this is an issue with composer If you just add pest to your composer.json and run composer update, you don't need to do anything special, like require phpunit first.
I just got caught out by this as well. Following the installation instructions in the documentation gave me an error. When I did (having followed the installation instructions exactly):
composer require pestphp/pest --dev
I got
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for pestphp/pest ^0.3.7 -> satisfiable by pestphp/pest[v0.3.7].
- Conclusion: remove phpunit/phpunit 9.4.0
- Conclusion: don't install phpunit/phpunit 9.4.0
- pestphp/pest v0.3.7 requires phpunit/phpunit >= 9.3.7 <= 9.3.11 -> satisfiable by phpunit/phpunit[9.3.10, 9.3.11].
- Can only install one of: phpunit/phpunit[9.3.10, 9.4.0].
- Can only install one of: phpunit/phpunit[9.3.11, 9.4.0].
- Installation request for phpunit/phpunit (locked at 9.4.0, required as ^9.3.10) -> satisfiable by phpunit/phpunit[9.4.0].
Installation failed, reverting ./composer.json to its original content.
Glad I found this thread.
We require 9.3 at the moment. 9.4 will be coming soon. :)
See https://github.com/pestphp/pest/pull/199. :)
Just to be clear, I had "phpunit/phpunit": "^9.3.10" in composer.json, as per the installation instructions in the documentation, when I ran composer require pestphp/pest --dev
馃し
Yeh, that happens for the same reason that we used to conflcit with phpunit 9.3, which is what the issue was about. This is really a missing feature of composer. If you just add pest manually to your composer.json and run composer update, phpunit should be downgraded automatically in order to install pest. If that does something odd in composer 1.x, upgrade to 2.x, since the update command is way better in composer 2.
All this aside, the next release of pest will support phpunit 9.4.0.
Just released Pest v0.3.8 with support for PHPUnit 9.4.0 馃憤馃徎
I'm happy to edit the docs to reflect this if you want.
Edit: @owenvoke got in before me!
Most helpful comment
Just got caught by this.
Maybe update the installation docs (https://pestphp.com/docs/installation/) - newcomers are going to be put off by the install dependency failure. It currently gets you to add the PHPUnit dependency first, before then adding the Pest dependency - which will fail.