Phpunit (install) error

I tried installing phpunit, the installation itself seems fine.

I can run "phpunit", but when I try to run the test "phpunit test.php", I get

  '"" C: \ Program' is not recognized as an internal or external command,
 operable program or batch file.
 PHPUnit 3.3.17 by Sebastian Bergmann.

 ..

 Time: 0 seconds

 OK (2 tests, 2 assertions) 

as you can see, phpunit works, but with something weird first. and in netbeans, I get "" "C: \ Program" is not recognized as an internal or external command, operating program or batch file. "and he stops

+4
source share
5 answers

When you installed PHPUnit, he made the phpunit.bat file in your PHP installation directory. For example, mine was in C:\PHP\phpunit.bat .

Open this file in Notepad. Below you will see a line that looks something like

 set PHPBIN=".\php.exe" 

Change this to the correct absolute path like

 set PHPBIN="C:\php.exe" 

If the path has a space in it, you need to escape it with double quotes, e.g.

 set PHPBIN="""C:\some long path\php.exe""" 

Hope this helps.

+14
source

I had the same problem when running this command in:

phpunit -v

I saw the following error:

'pupunit' is not recognized as an internal or external command, operating program, or batch file.

I will copy phpunit.bat to the system32 folder (C: \ Windows \ System32) and it works.

+3
source

This is a bug in PHPUnit . This has been fixed in version 3.4.

Just upgrade to the latest version:

 pear channel-update pear install phpunit/PHPunit 

and it should work correctly.

+1
source

It looks like a DOS 8.3 write error. You must change the path name in phpunit.bat to shorthand notation.

You can find this notation by looking at the following command in the DOS prompt: dir / o: e / p / x

(Or use the double quotes that Nicholas mentioned)

0
source

Here is the problem "C: \ program ..". While phpunit is running, it cannot recognize it.
Thus, you can refer to the Install PHPUnit on Windows link to cross-check the installation of PHPUnit.
This should help you.

0
source

All Articles