Below are the steps to install PHPUnit on Windows. Irrespective of whether you are using WAMP or XAMP installation steps shall remain the same.
bin
in C drive.C:\bin
to your environment.Then click on Advanced system settings
in the left sidebar.
Now in the Advanced
tab click on Environment Variables
button at the bottom left.
In the System variables section scroll down and select the line where the Variable column value is Path
. Click on Edit.
Now right click into the Variable value
input box and copy it’s value.
Paste it in Notepad. Now add ;C:\bin
at the end.
Now copy all this and paste it in Variable value
. Save it.
phpunit.phar
and move it to C:\bin
folder.cd C:\bin
and hit enter. Then type echo @php "%~dp0phpunit.phar" %* > phpunit.cmd
and hit enter. Close and again start command prompt.phpunit --version
in command prompt. You should get something like PHPUnit x.y.z by Sebastian Bergmann and contributors.
‘phpunit’ is not recognized as an internal or external command,
operable program or batch file.
Please note that it is not recommended to install PHPUnit globally, as /usr/bin/phpunit or /usr/local/bin/phpunit, for instance.
Instead, PHPUnit should be managed as a project-local dependency.
source: https://phpunit.readthedocs.io/en/9.3/installation.html#global-installation
thanks a lot. it worked
I am using Windows 10, php 7.1.17, 64bit. I following your instructions to the T, and yet, Step IV does not work, nothing gets displayed. I am using WampServer 3.13. When inside Wamp, i click on the local host, it works. I am using Explorer for this, and http://localhost/ does bring up the index.php in my www folder.
C:\Users\owner>phpunit –version
Could not open input file: c:\bin\phpunit.phar
My path is:
C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\binaries\php\php_runningversion;C:\app\owner\product\11.2.0\dbhome_2\bin;C:\app\owner\product\12.1.0\dbhome_1\bin;C:\app\owner\product\11.2.0\dbhome_1\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;c:\python27;C:\Program Files (x86)\Java\jdk1.7.0_51\bin;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\OpenVPN\bin;C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\bin;C:\Program Files (x86)\Zend\ZendServer\bin;C:\Program Files (x86)\Zend\MySQL55\bin;C:\Program Files (x86)\Brackets\command;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Git\cmd;C:\HashiCorp\Vagrant\bin;c:\bin;
Thanks a lot for help. It was very useful.