Repository navigation
Need to upgrade phpunit for php 7.2 #132
Description
Activity
Thanks for reporting! Can you show the output of
composer info? Also, have you tried runningcomposer update?sebastianbergmann/phpunit#2472 suggests this should be omitted with PHPUnit 5.7.11
It seems though that even 5.7.11 only suppresses the notice but does not fix the root cause. This will likely break the tests again once PHP >7.2 has been released and
eachremoved. At this point there will not be a phpUnit version that supports PHP 5.6 and will have the required fix?It will take some more years for PHP 8.0 to be released. At that point, support for PHP 5.x can probably be dropped. See https://wiki.php.net/rfc/deprecations_php_7_2#each
Reacted by andig@andig can you confirm that using PHPUnit 5.7.11 fixes this issue? Also, do you see the same issue with the latest PHPUnit ^4.8? Can we even give a consistent
require-dev.phpunit = "^5.7.11 || ^4.8"that works across all supported PHP versions?5.7.11 works (the failures are ok), latest 4.8.36 still has the
eachproblem:~/htdocs/react-socket master ⇡ ❯ COMPOSER_ROOT_VERSION=`git describe --abbrev=0` composer require phpunit/phpunit:5.7.11 sebastian/exporter:^2.0 ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 33 installs, 0 updates, 0 removals - Installing evenement/evenement (v3.0.1): Loading from cache - Installing react/event-loop (v0.4.3): Downloading (100%) - Installing react/stream (v0.7.4): Loading from cache - Installing react/promise (v2.5.1): Loading from cache - Installing react/promise-timer (v1.2.0): Loading from cache - Installing react/dns (v0.4.11): Loading from cache - Installing react/cache (v0.4.1): Loading from cache - Installing symfony/yaml (v3.3.11): Downloading (100%) - Installing sebastian/version (2.0.1): Loading from cache - Installing sebastian/resource-operations (1.0.0): Loading from cache - Installing sebastian/recursion-context (2.0.0): Loading from cache - Installing sebastian/object-enumerator (2.0.1): Loading from cache - Installing sebastian/global-state (1.1.1): Loading from cache - Installing sebastian/exporter (2.0.0): Loading from cache - Installing sebastian/environment (2.0.0): Loading from cache - Installing sebastian/diff (1.4.3): Loading from cache - Installing sebastian/comparator (1.2.4): Loading from cache - Installing doctrine/instantiator (1.1.0): Loading from cache - Installing phpunit/php-text-template (1.2.1): Loading from cache - Installing phpunit/phpunit-mock-objects (3.4.4): Loading from cache - Installing phpunit/php-timer (1.0.9): Loading from cache - Installing phpunit/php-file-iterator (1.4.2): Loading from cache - Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache - Installing phpunit/php-token-stream (2.0.1): Loading from cache - Installing phpunit/php-code-coverage (4.0.8): Loading from cache - Installing webmozart/assert (1.2.0): Loading from cache - Installing phpdocumentor/reflection-common (1.0.1): Loading from cache - Installing phpdocumentor/type-resolver (0.4.0): Loading from cache - Installing phpdocumentor/reflection-docblock (4.1.1): Loading from cache - Installing phpspec/prophecy (v1.7.2): Loading from cache - Installing myclabs/deep-copy (1.7.0): Loading from cache - Installing phpunit/phpunit (5.7.11): Downloading (100%) - Installing clue/block-react (v1.2.0): Loading from cache react/event-loop suggests installing ext-libevent (>=0.1.0) react/event-loop suggests installing ext-event (~1.0) react/event-loop suggests installing ext-libev (*) symfony/yaml suggests installing symfony/console (For validating YAML files using the lint command) sebastian/global-state suggests installing ext-uopz (*) phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.1) phpunit/phpunit suggests installing phpunit/php-invoker (~1.1) phpunit/phpunit suggests installing ext-xdebug (*) Writing lock file Generating autoload files ~/htdocs/react-socket master* ⇡ ❯ vendor/bin/phpunit PHPUnit 5.7.11 by Sebastian Bergmann and contributors. .................................S..........S.................. 63 / 141 ( 44%) .........................................FEEE.....I............ 126 / 141 ( 89%) ............... 141 / 141 (100%) Time: 21.62 seconds, Memory: 12.00MB There were 3 errors: 1) React\Tests\Socket\TcpConnectorTest::connectionToTcpServerShouldSucceedWithRemoteAdressSameAsTarget RuntimeException: Failed to listen on "tcp://127.0.0.1:9999": Address already in use /Users/andig/Documents/htdocs/react-socket/src/TcpServer.php:164 /Users/andig/Documents/htdocs/react-socket/tests/TcpConnectorTest.php:50 2) React\Tests\Socket\TcpConnectorTest::connectionToTcpServerShouldSucceedWithLocalAdressOnLocalhost RuntimeException: Failed to listen on "tcp://127.0.0.1:9999": Address already in use /Users/andig/Documents/htdocs/react-socket/src/TcpServer.php:164 /Users/andig/Documents/htdocs/react-socket/tests/TcpConnectorTest.php:68 3) React\Tests\Socket\TcpConnectorTest::connectionToTcpServerShouldSucceedWithNullAddressesAfterConnectionClosed RuntimeException: Failed to listen on "tcp://127.0.0.1:9999": Address already in use /Users/andig/Documents/htdocs/react-socket/src/TcpServer.php:164 /Users/andig/Documents/htdocs/react-socket/tests/TcpConnectorTest.php:87 -- There was 1 failure: 1) React\Tests\Socket\TcpConnectorTest::connectionToTcpServerShouldSucceed Expectation failed for method name is equal to <string:__invoke> when invoked 1 time(s). Method was expected to be called 1 times, actually called 0 times. ERRORS! Tests: 141, Assertions: 231, Errors: 3, Failures: 1, Skipped: 2, Incomplete: 1. ~/htdocs/react-socket master* ⇡ ❯ COMPOSER_ROOT_VERSION=`git describe --abbrev=0` composer require phpunit/phpunit:^4.8 sebastian/exporter:^1.2 ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 29 installs, 0 updates, 0 removals - Installing evenement/evenement (v3.0.1): Loading from cache - Installing react/event-loop (v0.4.3): Loading from cache - Installing react/stream (v0.7.4): Loading from cache - Installing react/promise (v2.5.1): Loading from cache - Installing react/promise-timer (v1.2.0): Loading from cache - Installing react/dns (v0.4.11): Loading from cache - Installing react/cache (v0.4.1): Loading from cache - Installing clue/block-react (v1.2.0): Loading from cache - Installing symfony/yaml (v3.3.11): Loading from cache - Installing sebastian/version (1.0.6): Loading from cache - Installing sebastian/global-state (1.1.1): Loading from cache - Installing sebastian/recursion-context (1.0.5): Loading from cache - Installing sebastian/exporter (1.2.2): Loading from cache - Installing sebastian/environment (1.3.8): Loading from cache - Installing sebastian/diff (1.4.3): Loading from cache - Installing sebastian/comparator (1.2.4): Loading from cache - Installing doctrine/instantiator (1.1.0): Loading from cache - Installing phpunit/php-text-template (1.2.1): Loading from cache - Installing phpunit/phpunit-mock-objects (2.3.8): Loading from cache - Installing phpunit/php-timer (1.0.9): Loading from cache - Installing phpunit/php-file-iterator (1.4.2): Loading from cache - Installing phpunit/php-token-stream (1.4.11): Loading from cache - Installing phpunit/php-code-coverage (2.2.4): Loading from cache - Installing webmozart/assert (1.2.0): Loading from cache - Installing phpdocumentor/reflection-common (1.0.1): Loading from cache - Installing phpdocumentor/type-resolver (0.4.0): Loading from cache - Installing phpdocumentor/reflection-docblock (4.1.1): Loading from cache - Installing phpspec/prophecy (v1.7.2): Loading from cache - Installing phpunit/phpunit (4.8.36): Loading from cache react/event-loop suggests installing ext-libevent (>=0.1.0) react/event-loop suggests installing ext-event (~1.0) react/event-loop suggests installing ext-libev (*) symfony/yaml suggests installing symfony/console (For validating YAML files using the lint command) sebastian/global-state suggests installing ext-uopz (*) phpunit/php-code-coverage suggests installing ext-xdebug (>=2.2.1) phpunit/phpunit suggests installing phpunit/php-invoker (~1.1) Writing lock file Generating autoload files ~/htdocs/react-socket master* ⇡ 7s ❯ vendor/bin/phpunit PHP Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /Users/andig/Documents/htdocs/react-socket/vendor/phpunit/phpunit/src/Util/Getopt.php on line 38 Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /Users/andig/Documents/htdocs/react-socket/vendor/phpunit/phpunit/src/Util/Getopt.php on line 38 PHPUnit 4.8.36 by Sebastian Bergmann and contributors.@andig Thanks for the confirmation!
This means we're in a situation where we can't reliably target a minimum required PHPUnit version across all out supported PHP versions. We would have to use
^5.7.11for PHP7.2+ only and the current^5.0 || ^4.8for all older versions.Given that this only applies to our
require-dev, I'm unsure if we're actually addressing a relevant issue here in the first place :-) Composer will always pick the latest available version possible with the version constrains, so there's no way it will pick an older unsupported version (unless you run with--prefer-lowest).It's my understanding that this issue is resolved now that you've run
composer updateand got a version of PHPUnit that is compatible with your PHP version. Do you think there's anything else that can be (needs to be) done here?Remaining confusion is that I'm stuck with 4.8 when installing from git clone, but that might be a composer or local issue:
~/htdocs/react-socket master* ❯ rm -rf vendor composer.lock ~/htdocs/react-socket master* ❯ COMPOSER_ROOT_VERSION=`git describe --abbrev=0` composer install Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 29 installs, 0 updates, 0 removals - Installing evenement/evenement (v3.0.1): Loading from cache - Installing react/event-loop (v0.4.3): Loading from cache - Installing react/stream (v0.7.4): Loading from cache - Installing react/promise (v2.5.1): Loading from cache - Installing react/promise-timer (v1.2.0): Loading from cache - Installing react/dns (v0.4.11): Loading from cache - Installing react/cache (v0.4.1): Loading from cache - Installing clue/block-react (v1.2.0): Loading from cache - Installing symfony/yaml (v3.3.11): Loading from cache - Installing sebastian/version (1.0.6): Loading from cache - Installing sebastian/global-state (1.1.1): Loading from cache - Installing sebastian/recursion-context (1.0.5): Loading from cache - Installing sebastian/exporter (1.2.2): Loading from cache - Installing sebastian/environment (1.3.8): Loading from cache - Installing sebastian/diff (1.4.3): Loading from cache - Installing sebastian/comparator (1.2.4): Loading from cache - Installing doctrine/instantiator (1.1.0): Loading from cache - Installing phpunit/php-text-template (1.2.1): Loading from cache - Installing phpunit/phpunit-mock-objects (2.3.8): Loading from cache - Installing phpunit/php-timer (1.0.9): Loading from cache - Installing phpunit/php-file-iterator (1.4.2): Loading from cache - Installing phpunit/php-token-stream (1.4.11): Loading from cache - Installing phpunit/php-code-coverage (2.2.4): Loading from cache - Installing webmozart/assert (1.2.0): Loading from cache - Installing phpdocumentor/reflection-common (1.0.1): Loading from cache - Installing phpdocumentor/type-resolver (0.4.0): Loading from cache - Installing phpdocumentor/reflection-docblock (4.1.1): Loading from cache - Installing phpspec/prophecy (v1.7.2): Loading from cache - Installing phpunit/phpunit (4.8.36): Loading from cache react/event-loop suggests installing ext-libevent (>=0.1.0) react/event-loop suggests installing ext-event (~1.0) react/event-loop suggests installing ext-libev (*) symfony/yaml suggests installing symfony/console (For validating YAML files using the lint command) sebastian/global-state suggests installing ext-uopz (*) phpunit/php-code-coverage suggests installing ext-xdebug (>=2.2.1) phpunit/phpunit suggests installing phpunit/php-invoker (~1.1) Writing lock file Generating autoload filesThis happens even after cleaning
~/.composer/cacheand without a globalconfig.json.~/htdocs/react-socket master* 45s ❯ php -v PHP 7.2.0RC3 (cli) (built: Oct 12 2017 20:44:49) ( ZTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.2.0-dev, Copyright (c) 1998-2017 Zend Technologies@andig This looks strange and can not be reproduced locally. Have you verified your
composer.jsonis in a clean state and has not been modified by the abovecomposer requirecalls?Reacted by andigwtf closing for own stupidity :/
Heh, no worries, these kind of things happen :-) Thanks for confirming back and glad this has been resolved for you 👍
Starting to see these notices: