4

i have tried installing phpunit the install itself seems fine.

i can run "phpunit" but when i try to run a 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)

so as u can see, phpunit runs but with something wierd 1st. and in netbeans, i get "'""C:\Program' is not recognized as an internal or external command, operable program or batch file." and it stops

5 Answers 5

13

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

Open up that file in Notepad. At the bottom you'll see a line that looks something like

set PHPBIN=".\php.exe"

Edit that to a correct absolute path, such as

set PHPBIN="C:\php.exe"

If the path has a space in it, you need to escape it with double quotes, such as

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

Hope that helps.

Sign up to request clarification or add additional context in comments.

Comments

3

I had same problem and when run this command in:

phpunit -v

I saw following error :

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

I copy the phpunit.bat in system32 folder( C:\Windows\System32 ) and it work.

Comments

1

This is a bug in PHPUnit. It was fixed in version 3.4.

Just upgrade to the newest version:

pear channel-update
pear install phpunit/PHPunit

and it should work correctly.

1 Comment

It appears that your link is invalid, though I found another one that is very similar, the main difference being that this issue is specificaly when using process isolation (@runInSeparateProcess). It's supposed to be fixed in 3.7.15.
0

This looks like a DOS 8.3 notation error. You should change the path-name in phpunit.bat to the shorthand notation.

You can find this notation by browsing in the DOS-prompt with the following command: dir /o:e /p /x

(Or use the double quotes like Nicholas mentioned)

Comments

0

Here "C:\program.." is the issue. While running phpunit, it is not able to recognize it.
So You can refer the link Installing PHPUnit On Windows for cross checking PHPUnit installation.
It should help you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.