TeemoBiceps
TeemoBiceps

Reputation: 496

Install phpunit on windows without composer won't work

I'm trying to install phpunit manually on my windows machine. I don't use composer, so I have to install it manually with a .phar file. I'm following the instructions from the official documentation:

https://phpunit.readthedocs.io/en/latest/installation.html#windows

I've done every step, but it won't work. phpunit --version will throw me the message 'phpunit' is not recognized as an internal or external command, operable program or batch file. Can someone Help me?

I'm using Windows 7 64-bit with XAMPP 3.2.2 and PHP 7.1.1.

EDIT:

My phpunit.cmd file location is C:\xampp\php\phar\phpunit.cmd. The file contains the code @php "%~dp0phpunit.phar" %*. I've added ;C:xampp\php\phar to my PATH variable.

Upvotes: 1

Views: 1546

Answers (1)

Ynhockey
Ynhockey

Reputation: 3932

In order to make Windows recognize any command, you must put the binary's path in the relevant environment variable (PATH). Before that you need to create some kind of file Windows can run natively (i.e. not a .phar – can be a command line / batch file or executable). Here are instructions:

https://phpunit.de/manual/current/en/installation.html#installation.phar.windows

Edit: If following the above instructions, it's also important to make sure that php itself is part of the PATH environment variable, so that it's possible to execute commands like php phpunit.phar.

Upvotes: 2

Related Questions