Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPUnit: local VS global install

Installing PHPUnit with composer globally seems more convenient to me for those two reasons: 1. Using it everywhere without needing an extra install. 2. Just running phpunitinstead of vendor/bin/phpunit (using an alias might solve this)

Are there any reasons why a local install might be the better choice? For example: using the exact same versions every time. (don't have a lot of experience with PHPUnit, so not sure if this really is an issue or not)

like image 479
Bert H Avatar asked Nov 07 '17 09:11

Bert H


1 Answers

The big disadvantage of installing packages globally is that you might end up with different versions of PHPUnit between developers in your team (unless you are the only developer). This might cause some side effects.

If you install it locally using composer.json, then every developer in your team will have exactly the same version as you do for that specific application. Also, everybody will see when you change the version in composer.json.

If you don't like typing vendor/bin/phpunit, you can use Makefile (which is also in your project):

test:
    vendor/bin/phpunit --configuration=test/Unit/phpunit.xml

then run it ...

make test
like image 100
zstate Avatar answered Nov 16 '22 19:11

zstate