我试图在我的Windows机器上手动安装phpunit。我不使用composer,所以我必须使用.phar文件手动安装它。我按照官方文档中的说明进行操作:
https://phpunit.readthedocs.io/en/latest/installation.html#windows
我已经完成了每一步,但它不会奏效。 phpunit --version
会向我发送消息'phpunit' is not recognized as an internal or external command, operable program or batch file.
有人可以帮助我吗?
我使用Windows 7 64位与XAMPP 3.2.2和PHP 7.1.1。
修改
我的phpunit.cmd文件位置为C:\xampp\php\phar\phpunit.cmd
。
该文件包含代码@php "%~dp0phpunit.phar" %*
。我已将;C:xampp\php\phar
添加到我的PATH变量中。
答案 0 :(得分:2)
为了让Windows识别任何命令,必须将二进制文件的路径放在相关的环境变量(PATH)中。在此之前,您需要创建一些Windows可以本机运行的文件(即不是.phar - 可以是命令行/批处理文件或可执行文件)。以下是说明:
https://phpunit.de/manual/current/en/installation.html#installation.phar.windows
编辑:如果遵循上述说明,确保php
本身是PATH环境变量的一部分也很重要,这样就可以执行{{1}之类的命令}}