You can use composer to install phpunit, for example, inside a Symfony2 project; but it’s better to install it as a separate binary as it allows you to run unit test on all php scripts and it integrates better in phpStorm.
Create folder to hold php bins
I used an Applications folder in my windows home; but you can also user C:\bin or something like that.
Add the folder to your Path: e.g. add “;C:\bin” to your PATH environment variable. In the Advanced System Properties, Environment variables:
Download the .phar file
Download https://phar.phpunit.de/phpunit.phar and save the file as C:\bin\phpunit.phar
Create a .bat wrapper
Open a command line (e.g., press Windows+R » type cmd » ENTER)
cd C:\bin echo @php "%~dp0phpunit.phar" %* > phpunit.cmd exit
Verify that it worked by openening a new command line: type “phpunit” and press enter. It should show the phpunit options.