According to @WouterJ:
You shouldn't require PHPunit as a dev dependency (and you've proofed with this issue again why you shouldn't).
Download the
phpunit.pharand put it in a directory that's in your$PATH.
Source: https://github.com/symfony/symfony/issues/18903#issuecomment-222294957
But the documentation doesn't recommend to install PHPUnit without Composer: http://symfony.com/doc/current/book/testing.html
Should the documentation mention that using phpunit.phar is the recommended way to use PHPUnit?
I tend to disagree.
If phpunit is not a dependency, then you don't have \PHPUnit_Framework_TestCase anymore and all your tests extends an abstract class which doesn't exist.
Furthermore, the IDE's won't be able to autocomplete the methods provided by PHPUnit.
@JEDIBC But you can't install PHPUnit with Composer and Symfony 3.1. Extending the class and autocomplete won't be available because the requirements will be broken.
I know you can't but it is a temporary situation.
Documenting that phpunit shouldn't be installed as dev dependency is an error for me.
@JEDIBC : Please note that this issue is an open question. I was looking for a way to avoid users frustrated by broken dependencies, recommending the usage of the .phar is probably the simplest solution.
The #6628 PR may be rewritten as something like _Due to a bug in [鈥, PHPUnit can't be installed with Composer. Until the bug is fixed, PHPUnit can be installed through the .phar file_.
It looks like the root problem has been fixed: https://github.com/phpspec/prophecy/pull/275
The problem has been fixed, it's now possible to install Symfony 3.1 and PHPUnit 5.4:
$ composer require "symfony/symfony:3.1.*" "phpunit/phpunit:~5.4" --no-interaction --no-progress -vvv --profile
[鈥
[146.4MB/15.16s] Writing lock file
[146.4MB/15.16s] Generating autoload files
[147.2MB/15.40s] Memory usage: 147.19MB (peak: 188.62MB), time: 15.4s
(use this command only during tests, PHPUnit should go in the require-dev section of composer.json)
$ composer require --dev phpunit/phpunit
Worked fine for me thx @alexislefebvre
Most helpful comment
I know you can't but it is a temporary situation.
Documenting that phpunit shouldn't be installed as dev dependency is an error for me.