Tagarchief: composer

Setup PHPUnit on Windows with Composer

Setting up PHPUnit using Composer is an option that is available since composer 3.7.5. Older 3.7 versions aren’t considered stable to use this way. I needed to have PHPUnit to run tests in my PHPStorm environment, and I didn’t want to do it by hand or struggle with PEAR on my local server. Composer is a good and easy alternative.

I assume you have installed Composer using the Windows installer found here

Just run the following command to get composer to install PHPUnit globally, for all the projects, and not just this one:

composer global require « phpunit/phpunit=3.7.* »

After that, go to your environment variables, and append the Composer folder to the end of the ‘PATH’ variable :

C:\Users\<username>\AppData\Roaming\Composer\vendor\bin

Substitute <username> with the user name that installed composer.

And you’re ready to go!