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

4

5 回答 5

13

当您安装 PHPUnit 时,它会phpunit.bat在您的 PHP 安装目录中创建一个文件。例如,我的在C:\PHP\phpunit.bat.

在记事本中打开该文件。在底部你会看到一条看起来像这样的线

set PHPBIN=".\php.exe"

将其编辑为正确的绝对路径,例如

set PHPBIN="C:\php.exe"

如果路径中有空格,则需要用双引号将其转义,例如

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

希望有帮助。

于 2009-10-22T13:44:52.963 回答
3

我有同样的问题,当运行这个命令时:

phpunit -v

我看到以下错误:

'pupunit' 不是内部或外部命令、可运行程序或批处理文件。

我将phpunit.bat复制到system32 文件夹( C:\Windows\System32 )中,它可以工作。

于 2012-03-14T13:50:56.983 回答
1

这是PHPUnit 中的一个错误。它已在 3.4 版中修复。

只需升级到最新版本:

pear channel-update
pear install phpunit/PHPunit

它应该可以正常工作。

于 2010-03-04T10:52:49.863 回答
0

这看起来像是 DOS 8.3 符号错误。您应该将 phpunit.bat 中的路径名更改为简写符号。

您可以通过使用以下命令浏览 DOS 提示符来找到此符号:dir /o:e /p /x

(或者使用 Nicholas 提到的双引号)

于 2011-09-11T18:54:40.673 回答
0

这里“C:\program..”是问题所在。在运行 phpunit 时,它无法识别它。
因此,您可以参考链接在 Windows上安装 PHPUnit 以交叉检查 PHPUnit 安装。
它应该可以帮助你。

于 2013-09-11T04:06:07.640 回答