Install phpunit on windows

后端 未结 5 461
傲寒
傲寒 2020-12-07 13:39

How to install phpunit?

I read documentation https://github.com/sebastianbergmann/phpunit, but have an error:

>pear upgrade PEAR
Nothing to upgrad         


        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-07 14:29

    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

    • Open command prompt. Type cd C:\bin and hit enter.

    • Then type echo @php "%~dp0phpunit.phar" %* > phpunit.cmd and hit enter.

    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/

提交回复
热议问题