1
votes

I am following these instructions:

Windows Globally installing the PHAR involves the same procedure as manually installing Composer on Windows:

Create a directory for PHP binaries; e.g., C:\bin

Append ;C:\bin to your PATH environment variable (related help)

Download https://phar.phpunit.de/phpunit-6.2.phar and save the file as C:\bin\phpunit.phar

Open a command line (e.g., press Windows+R » type cmd » ENTER)

Create a wrapping batch script (results in C:\bin\phpunit.cmd):

C:\Users\username> cd C:\bin C:\bin> echo @php "%~dp0phpunit.phar" %*

phpunit.cmd C:\bin> exit Open a new command line and confirm that you can execute PHPUnit from any path:

C:\Users\username> phpunit --version PHPUnit x.y.z by Sebastian Bergmann and contributors.

My PHP works because "php -v" returns version etc. but when I run phpunit.cmd i get this:

P:\phpunit>■@

'■@' is not recognized as an internal or external command, operable program or batch file.

What am i doing wrong?

EDIT:

running "php phpunit.phar" as suggested by @delboy1978uk gives me the list of commands option for phpunit. So why I get those odd characters?

2
Change echo @php "%~dp0phpunit.phar" %* in your .bat to a plain ol php phpunit.phar and see if that worksdelboy1978uk
@delboy1978uk I've updated the question with your suggestion. It works, but I'm still unable to fix my fileTerix

2 Answers

1
votes

I completely deleted the script file, made one new from scratch, added the line "php phpunit.phar %*" (without double quotes) and now it works. Maybe an odd file enconding?

1
votes

To fix this I edited the file in notepad to contain exactly this text:

php %~dp0phpunit.phar %*

Then you have to go to save as, and ensure the encoding type is ANSI when you save it. Then it works as expected.