Closed sebastianbergmann closed 4 years ago
In the meantime, here is how you can install PHPUnit 9 with Composer 2 for PHP 8:
$ php-80 --version
PHP 8.0.0-dev (cli) (built: Jun 26 2020 09:26:43) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.0.0-dev, Copyright (c), by Zend Technologies
$ php-80 /usr/local/bin/composer --version
Composer version 2.0-dev (2.0-dev+4a2ea3c67aa49a3dce68ef5a56614e1941d68965) 2020-06-25 07:16:23
$ php-80 /usr/local/bin/composer require --dev phpunit/phpunit
Using version ^5.2 for phpunit/phpunit
./composer.json has been created
Running composer update phpunit/phpunit
Loading composer repositories with package information
Updating dependencies
Lock file operations: 22 installs, 0 updates, 0 removals
- Locking doctrine/instantiator (1.3.1)
- Locking myclabs/deep-copy (1.6.1)
- Locking phpdocumentor/reflection-docblock (2.0.5)
- Locking phpspec/prophecy (v1.5.0)
- Locking phpunit/php-code-coverage (3.2.0)
- Locking phpunit/php-file-iterator (1.4.5)
- Locking phpunit/php-text-template (1.2.1)
- Locking phpunit/php-timer (1.0.8)
- Locking phpunit/php-token-stream (1.4.12)
- Locking phpunit/phpunit (5.2.7)
- Locking phpunit/phpunit-mock-objects (3.1.3)
- Locking sebastian/code-unit-reverse-lookup (1.0.0)
- Locking sebastian/comparator (1.2.4)
- Locking sebastian/diff (1.4.1)
- Locking sebastian/environment (1.3.7)
- Locking sebastian/exporter (1.2.2)
- Locking sebastian/global-state (1.1.1)
- Locking sebastian/recursion-context (1.0.5)
- Locking sebastian/resource-operations (1.0.0)
- Locking sebastian/version (2.0.1)
- Locking symfony/polyfill-ctype (v1.17.1)
- Locking symfony/yaml (v3.4.42)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 22 installs, 0 updates, 0 removals
- Downloading phpdocumentor/reflection-docblock (2.0.5)
- Downloading phpunit/php-token-stream (1.4.12)
- Downloading symfony/yaml (v3.4.42)
- Downloading sebastian/environment (1.3.7)
- Downloading sebastian/diff (1.4.1)
- Downloading phpunit/phpunit-mock-objects (3.1.3)
- Downloading phpunit/php-timer (1.0.8)
- Downloading sebastian/code-unit-reverse-lookup (1.0.0)
- Downloading phpunit/php-code-coverage (3.2.0)
- Downloading phpspec/prophecy (v1.5.0)
- Downloading myclabs/deep-copy (1.6.1)
- Downloading phpunit/phpunit (5.2.7)
- Installing phpdocumentor/reflection-docblock (2.0.5): Extracting archive
- Installing phpunit/php-token-stream (1.4.12): Extracting archive
- Installing symfony/polyfill-ctype (v1.17.1): Extracting archive
- Installing symfony/yaml (v3.4.42): Extracting archive
- Installing sebastian/version (2.0.1): Extracting archive
- Installing sebastian/resource-operations (1.0.0): Extracting archive
- Installing sebastian/global-state (1.1.1): Extracting archive
- Installing sebastian/recursion-context (1.0.5): Extracting archive
- Installing sebastian/exporter (1.2.2): Extracting archive
- Installing sebastian/environment (1.3.7): Extracting archive
- Installing sebastian/diff (1.4.1): Extracting archive
- Installing sebastian/comparator (1.2.4): Extracting archive
- Installing phpunit/php-text-template (1.2.1): Extracting archive
- Installing doctrine/instantiator (1.3.1): Extracting archive
- Installing phpunit/phpunit-mock-objects (3.1.3): Extracting archive
- Installing phpunit/php-timer (1.0.8): Extracting archive
- Installing phpunit/php-file-iterator (1.4.5): Extracting archive
- Installing sebastian/code-unit-reverse-lookup (1.0.0): Extracting archive
- Installing phpunit/php-code-coverage (3.2.0): Extracting archive
- Installing phpspec/prophecy (v1.5.0): Extracting archive
- Installing myclabs/deep-copy (1.6.1): Extracting archive
- Installing phpunit/phpunit (5.2.7): Extracting archive
6 package suggestions were added by new dependencies, use `composer suggest` to see details.
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
3 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
PHPUnit 5.2.7 has
"php": ">=5.6"
in its composer.json
.
That is not a version constraint.
$ rm -rf composer.json composer.lock vendor
$ php-80 /usr/local/bin/composer require --dev phpunit/phpunit ^9.2
[RuntimeException]
No composer.json present in the current directory, this may be the cause of the following exception.
[InvalidArgumentException]
Package phpunit/phpunit at version ^9.2 has a PHP requirement incompatible with your PHP version, PHP extensions and Composer version
require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
PHPUnit 9.2.5 has
"php": "^7.3"
in its composer.json
.
Until this ticket is closed, you can use the following:
$ php-80 /usr/local/bin/composer require --dev --ignore-platform-req=php phpunit/phpunit ^9.2
./composer.json has been created
Running composer update phpunit/phpunit
Loading composer repositories with package information
Updating dependencies
Lock file operations: 31 installs, 0 updates, 0 removals
- Locking doctrine/instantiator (1.3.1)
- Locking myclabs/deep-copy (1.9.5)
- Locking phar-io/manifest (1.0.3)
- Locking phar-io/version (2.0.1)
- Locking phpdocumentor/reflection-common (2.1.0)
- Locking phpdocumentor/reflection-docblock (4.3.4)
- Locking phpdocumentor/type-resolver (1.2.0)
- Locking phpspec/prophecy (v1.10.3)
- Locking phpunit/php-code-coverage (8.0.2)
- Locking phpunit/php-file-iterator (3.0.2)
- Locking phpunit/php-invoker (3.0.1)
- Locking phpunit/php-text-template (2.0.1)
- Locking phpunit/php-timer (5.0.0)
- Locking phpunit/php-token-stream (4.0.2)
- Locking phpunit/phpunit (9.2.5)
- Locking sebastian/code-unit (1.0.3)
- Locking sebastian/code-unit-reverse-lookup (2.0.1)
- Locking sebastian/comparator (4.0.2)
- Locking sebastian/diff (4.0.1)
- Locking sebastian/environment (5.1.1)
- Locking sebastian/exporter (4.0.1)
- Locking sebastian/global-state (4.0.0)
- Locking sebastian/object-enumerator (4.0.1)
- Locking sebastian/object-reflector (2.0.1)
- Locking sebastian/recursion-context (4.0.1)
- Locking sebastian/resource-operations (3.0.1)
- Locking sebastian/type (2.1.0)
- Locking sebastian/version (3.0.0)
- Locking symfony/polyfill-ctype (v1.17.1)
- Locking theseer/tokenizer (1.1.3)
- Locking webmozart/assert (1.9.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 31 installs, 0 updates, 0 removals
- Downloading phpunit/phpunit (9.2.5)
- Installing symfony/polyfill-ctype (v1.17.1): Extracting archive
- Installing webmozart/assert (1.9.0): Extracting archive
- Installing phpdocumentor/reflection-common (2.1.0): Extracting archive
- Installing phpdocumentor/type-resolver (1.2.0): Extracting archive
- Installing phpdocumentor/reflection-docblock (4.3.4): Extracting archive
- Installing phpunit/php-token-stream (4.0.2): Extracting archive
- Installing sebastian/version (3.0.0): Extracting archive
- Installing sebastian/type (2.1.0): Extracting archive
- Installing sebastian/resource-operations (3.0.1): Extracting archive
- Installing sebastian/recursion-context (4.0.1): Extracting archive
- Installing sebastian/object-reflector (2.0.1): Extracting archive
- Installing sebastian/object-enumerator (4.0.1): Extracting archive
- Installing sebastian/global-state (4.0.0): Extracting archive
- Installing sebastian/exporter (4.0.1): Extracting archive
- Installing sebastian/environment (5.1.1): Extracting archive
- Installing sebastian/diff (4.0.1): Extracting archive
- Installing sebastian/comparator (4.0.2): Extracting archive
- Installing sebastian/code-unit (1.0.3): Extracting archive
- Installing phpunit/php-timer (5.0.0): Extracting archive
- Installing phpunit/php-text-template (2.0.1): Extracting archive
- Installing phpunit/php-invoker (3.0.1): Extracting archive
- Installing phpunit/php-file-iterator (3.0.2): Extracting archive
- Installing theseer/tokenizer (1.1.3): Extracting archive
- Installing sebastian/code-unit-reverse-lookup (2.0.1): Extracting archive
- Installing phpunit/php-code-coverage (8.0.2): Extracting archive
- Installing doctrine/instantiator (1.3.1): Extracting archive
- Installing phpspec/prophecy (v1.10.3): Extracting archive
- Installing phar-io/version (2.0.1): Extracting archive
- Installing phar-io/manifest (1.0.3): Extracting archive
- Installing myclabs/deep-copy (1.9.5): Extracting archive
- Installing phpunit/phpunit (9.2.5): Extracting archive
4 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
20 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
$ php-80 ./vendor/bin/phpunit --version
PHPUnit 9.2.5 by Sebastian Bergmann and contributors.
@sebastianbergmann thanks for mentioning us; @jaapio and I will look into this!
phpdocumentor/reflection-common
is upgraded, 2.2.0 supports php 8.
phpdocumentor/reflection-common
is upgraded, 2.2.0 supports php 8.
Thank you, @jaapio.
phpdocumentor/type-resolver
is now also upgraded, from version 1.3.0
phpdocumentor/type-resolver
is now also upgraded, from version 1.3.0
Thank you, @jaapio.
The phar.io components (phar-io/manifest
and phar-io/version
) are updated to 2.0.1 and 3.0.2, respectively.
theseer/tokenizer
is pending because of https://github.com/theseer/tokenizer/issues/11
The phar.io components (
phar-io/manifest
andphar-io/version
) are updated to 2.0.1 and 3.0.2, respectively.
Thank you, @theseer.
Thank you @sebastianbergmann.
myclabs/deep-copy
is tagged 1.10.0
with PHP 8 support.
myclabs/deep-copy
is tagged1.10.0
with PHP 8 support.
Thank you, @Ayesh and @theofidry.
CC @davedevelopment @robertbasic @padraic for mockery/mockery
because of https://github.com/phpDocumentor/ReflectionDocBlock/runs/814383275?check_suite_focus=true
CC @cordoval @davedevelopment @aik099 for hamcrest/hamcrest-php
because of https://github.com/phpDocumentor/ReflectionDocBlock/runs/814383275?check_suite_focus=true
Currently, phpunit will install on PHP 8.0 with the following composer.json config, so these needs to be solved urgently:
"replace": {
"phar-io/manifest": "1.0.99",
"phar-io/version": "2.0.99",
"phpspec/prophecy": "1.10.99",
"sebastian/diff": "4.0.1",
"phpunit/php-code-coverage": "9.0"
}
@sebastianbergmann can you update master
to:
phar-io/manifest
2.x depphar-io/version
3.x depphpspec/prophecy
and allow php 8.0 until fixed in official reposebastian/diff
with official php8 supportphpunit/php-code-coverage
with official php8 supportthanks
phpunit/phpunit
, sebastian/global-state
, and phpunit/php-code-coverage
will be released/tagged with ^8.0
in their composer.json
on August 7, 2020 for PHPUnit 9.3.
I somehow forgot about sebastian/diff
apparently, thank you for bringing that to my attention. I will also take care of allowing the new versions of phar-io/manifest
and phar-io/version
.
I will not fork phpspec/prophecy
or anything else, however.
Currently, phpunit will install on PHP 8.0 with the following composer.json config
PHPUnit 9.2 can be installed with Composer 2
$ composer require --dev --ignore-platform-req=php phpunit/phpunit ^9.2
as explained in https://github.com/sebastianbergmann/phpunit/issues/4325#issuecomment-650064938.
And with Composer 1:
$ composer require --dev --ignore-platform-reqs phpunit/phpunit ^9.2
Prophecy is on the list; it seems to only require a couple of changes but I'm tied up for the next few days
Prophecy is on the list; it seems to only require a couple of changes but I'm tied up for the next few days
Thank you, @ciaranmcnulty for taking the time to work on this. It's not urgent (PHP 8 is ~ 6 months away, PHPUnit 9.3 is ~ 1 month away), but, of course, the sooner the better.
Regarding phpspec/prophecy-phpunit, it requires no change by itself. But it of course needs support from Prophecy first.
I opened phpspec/prophecy#477, but it's rather complicated due to PHP 8's Reflection API changes. (deprecated methods, removal of a method, etc). I'd appreciate any reviews/contributions.
@sebastianbergmann, @jaapio https://github.com/hamcrest/hamcrest-php/pull/65 is now ready for review by @davedevelopment, which will allow PHP Documentor to progress.
@sebastianbergmann, @jaapio https://github.com/mockery/mockery/pull/1072 is now also ready for review by @davedevelopment, which will allow PHP Documentor to progress. Lots of changes!
@GrahamCampbell Thank you for taking care of https://github.com/hamcrest/hamcrest-php/pull/65 and https://github.com/mockery/mockery/pull/1072.
@davedevelopment Thank you for merging these changes for hamcrest/hamcrest-php
and mockery/mockery
.
There's still the small matter of merging mockery 1.3 -> master
, so the fixes will be available in the 1.4.x series too. Hopefully I can take care of that today. There will certainly be merge conflicts. ;)
Thanks for organising this tracker issue @sebastianbergmann, it's very handy as most of our dependencies for phpspec are here too :)
phpspec/prophecy
has been tagged as 1.11.0
with I think all of the reflection deprecations fixed (thanks to @Ayesh)
However since that release I've noticed that doubling a class or interface that uses union types fails hard, so we will need to fix that in prophecy before advertising 8.0 support
@webmozart are you able to tag a release on your repo? Because you don't have a branch alias, there is no way to install dev versions of your package.
Thank you, Ciaran, for taking care of phpspec/prophecy
. Next stop: phpspec/prophecy-phpunit
. :)
@GrahamCampbell I'm tagging @BackEndTea for this who is currently maintaining the assert package
It actually looks like there are still significant problems with PHP 8 on that package: https://travis-ci.org/github/webmozart/assert/jobs/696587522.
webmozart/assert
pass PHP nightly tests: https://travis-ci.org/github/webmozart/assert/jobs/705105782
Oh yeh. Not sure how I ended up at that other build!
webmozart/aseert 1.9.1 is php 8.0 compatible @sebastianbergmann. Thanks to @Ayesh & @GrahamCampbell
RE hamcrest, 2.0.1 release PR is in now: https://github.com/hamcrest/hamcrest-php/pull/67.
prophecy-phpunit is now released as 2.0.1 advocating PHP 8 support (in the limits of the PHP 8 support in prophecy itself)
Hamcrest 2.0.1, Mockery 1.3.2, Mockery 1.4.1 are now released.
prophecy-phpunit is now released as 2.0.1 advocating PHP 8 support (in the limits of the PHP 8 support in prophecy itself)
Thank you, Christophe.
The last remaining project, theseer/tokenizer
has composer.json constraints allowing PHP 8, and tests passing on PHP nightly builds. It just needs a tagged release. Hopefully @theseer tags one, but I suppose the new release probably contains some additional changes in regards to some minor differences in PHP 8's lexer T_WHITESPACE handling.
phpdocumentor/reflection-docblock
build is now passing on PHP 8, we need to fix a couple of unit tests that are using deprecated functionality. After that, we can create a tag.
Yes, theseer/tokenizer
is semi-effected by the new T_WHITESPACE handling. Semi-Effected, because the XML-Transformation code almost by accident filters out the side effects of the aforementioned change.
As this is what PHPUnit uses, one could argue that I should simply tag a new release with 8.0 among the versions supported.
But I'm not sure whether or not that's the correct way to go: While I do not want keep everybody waiting for no reason, the intermediate format is different and thus technically not correct.
So I'm a bit conflicted about what's best?
Match cannot be used as a class name in PHP 8.0 so PHPUnit's mock object code is currently broken.
While I'm not fully happy with the implementation, theseer/tokenizer
has been updated and should now work with 7.2+ and 8.0+.
theseer/tokenizer
has been updated and should now work with 7.2+ and 8.0+.
Thank you, Arne.
I spoke too soon about Prophecy, but it is now passing its nightly build if we force phpunit and phpdocumentor to their @dev
versions.
I'll add PHP8 to the composer.json after feature freeze and when phpdocumentor is tagged (if we wait for phpunit that'll presumably cause a deadlock?)
I just released https://github.com/phpDocumentor/ReflectionDocBlock/releases/tag/5.2.0 should be good to go as far as I was able to check. This should clear the road for others to update.
Thanks @jaapio that fixed the prophecy issues 👍
We now use nikic/php-parser
which has not been updated for https://github.com/php/php-src/commit/7a3dcc3e339cde2177ba4fe8fc45f78c94dfbb29 yet. This is why the build currently fails on PHP 8.
I would like to thank everyone who has contributed to the effort of making PHPUnit itself as well as its dependencies (and their dependencies ...) installable on PHP 8.
This is awesome! When will it be available?
August 7th, though note that you may still have to ignore platform requirements when installing PHPUnit with composer, even after that release, since not all PHPUnit's dependencies actually allow PHP 8 yet, however all of them at least work well enough so that PHPUnit and it's test suite can run.
not all PHPUnit's dependencies actually allow PHP 8 yet
The only dependencies that do not have releases yet that allow PHP 8 are phpunit/php-code-coverage
and sebastian/global-state
:
$ composer install
No lock file found. Updating dependencies instead of installing from lock file. Use composer update over composer install if you do not have a lock file.
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires phpunit/php-code-coverage ^9.0, found phpunit/php-code-coverage[dev-master, 9.0.x-dev (alias of dev-master)] but it does not match your minimum-stability.
Problem 2
- Root composer.json requires sebastian/global-state ^5.0, found sebastian/global-state[dev-master, 5.0.x-dev (alias of dev-master)] but it does not match your minimum-stability.
You are using a snapshot build of Composer 2, which may be the cause of the problem. Run `composer self-update --stable` and then try again. In case it solves the problem, please report an issue mentioning Composer 2.
Versions of these packages that allow PHP 8 will be tagged when PHPUnit 9.3 is tagged.
PHPUnit 9 is being tested against nightly builds of PHP 8 for quite a while and it is safe to say that -- as of right now -- PHPUnit 9 works on PHP 8. While some things might still change until PHP 8.0.0 is released, it is time to make the support for PHP 8 official.
However, this is not as simple as applying
to this repository for
phpunit/phpunit
.PHP 8.0 also needs to be allowed in the
composer.json
files of PHPUnit's dependencies:phpunit/php-code-coverage
phpunit/php-file-iterator
phpunit/php-invoker
phpunit/php-text-template
phpunit/php-timer
phpunit/php-token-stream
sebastian/code-unit
sebastian/code-unit-reverse-lookup
sebastian/comparator
sebastian/diff
sebastian/environment
sebastian/exporter
sebastian/global-state
sebastian/object-enumerator
sebastian/object-reflector
sebastian/recursion-context
sebastian/resource-operations
sebastian/type
sebastian/version
doctrine/instantiator
(has"php": "^7.1 || ^8.0"
in 1.3.1)symfony/polyfill-ctype
(has"php": ">=5.3.3"
in 1.17.1)myclabs/deep-copy
CC @mnapoli and @theofidryphar-io/manifest
CC @theseerphar-io/version
CC @theseerphpdocumentor/reflection-common
CC @jaapio and @mvrielphpdocumentor/reflection-docblock
CC @jaapio and @mvrielphpdocumentor/type-resolver
CC @jaapio and @mvrielphpspec/prophecy-phpunit
CC @ciaranmcnulty and @stofphpspec/prophecy
CC @ciaranmcnulty and @stoftheseer/tokenizer
CC @theseerwebmozart/assert
CC @webmozartOf course, I will take care of all dependencies that live in the
sebastian/
andphpunit/
namespaces myself.