As said by @Wilt Installation via pear doesn't works any longer. Follow below steps instead
Step I: Create a directory named bin in C drive.
Step II: Now add the path C:\bin to your environment.
- To do this click on Windows icon and right click on Computer and then
select Properties.
- Then click on Advanced system settings -> Advanced
-> Environment Variables.
- In the System variables section scroll down and select the line where the Variable column value is Path. Click on
Edit.
- Now add (append at the end)
;C:\bin
at the end.
Step III: Download phpunit phar file to C:\bin folder.
- If you are PHP 7 then download the phar file from
https:// phar.phpunit.de/phpunit-6.2.phar.
Else if you are using PHP
5.6 then download the phar file from https:// phar.phpunit.de/phpunit-5.7.phar.
- Once downloaded rename the
file to
phpunit.phar
and move it to C:\bin folder.
Step IV: Create a batch script phpunit.cmd
To verify PHPUnit has been installed type phpunit --version
in command prompt. You should get something like PHPUnit x.y.z by Sebastian Bergmann and contributors
.
Reference: https://perials.com/installing-phpunit-windows/