Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommend to install PHPUnit from the .phar archive (without Composer)? #6625

Closed
alexislefebvre opened this issue May 30, 2016 · 7 comments
Closed
Labels
hasPR A Pull Request has already been submitted for this issue.

Comments

@alexislefebvre
Copy link
Contributor

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.phar and put it in a directory that's in your $PATH.

Source: symfony/symfony#18903 (comment)

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?

@alexislefebvre alexislefebvre changed the title Recommend to install PHPUnit without Composer? Recommend to install PHPUnit from the .phar archive (without Composer)? May 30, 2016
kix added a commit to kix/symfony-docs that referenced this issue May 30, 2016
This fix adds a recommendation of installing PHPUnit as a PHAR archive, as suggested in symfony#6625.
@kix kix mentioned this issue May 30, 2016
@JEDIBC
Copy link

JEDIBC commented Jun 2, 2016

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.

@alexislefebvre
Copy link
Contributor Author

alexislefebvre commented Jun 2, 2016

@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.

@JEDIBC
Copy link

JEDIBC commented Jun 2, 2016

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.

@alexislefebvre
Copy link
Contributor Author

alexislefebvre commented Jun 3, 2016

@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.

@xabbuh xabbuh added the hasPR A Pull Request has already been submitted for this issue. label Jun 5, 2016
@alexislefebvre
Copy link
Contributor Author

It looks like the root problem has been fixed: phpspec/prophecy#275

@alexislefebvre
Copy link
Contributor Author

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)

wouterj pushed a commit that referenced this issue Jun 21, 2016
This fix adds a recommendation of installing PHPUnit as a PHAR archive, as suggested in #6625.
wouterj added a commit that referenced this issue Jun 21, 2016
This PR was submitted for the 3.1 branch but it was merged into the 2.7 branch instead (closes #6628).

Discussion
----------

Fix for #6625

This fix adds a recommendation of installing PHPUnit as a PHAR archive, as suggested in #6625.

Commits
-------

1f2bbb6 Fix for #6625
@Glideh
Copy link

Glideh commented Dec 20, 2017

$ composer require --dev phpunit/phpunit

Worked fine for me thx @alexislefebvre

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hasPR A Pull Request has already been submitted for this issue.
Projects
None yet
Development

No branches or pull requests

4 participants