Pear PHPUnit命令在哪里

时间:2011-05-28 01:17:21

标签: pear

如下图所示,我安装了Pear,并且有一个PhpUnit文件夹,但是当我运行此代码时(来自Yii上的一本书),

    % phpunit functional/SiteTest.php

告诉我

-bash: phpunit: command not found

我假设存在Phpunit文件夹,我已正确安装它。事实上,它说安装o.k.在终端。

我能找到这个命令的任何想法吗?

enter image description here

3 个答案:

答案 0 :(得分:16)

运行

pear config-get bin_dir

将告诉您PEAR安装可执行文件的位置(如phpunit)。

获取目录名后,您需要将其添加到PATH中。一种方法是编辑主目录中的.profile文件(它是隐藏的),并添加以下行:

export PATH=<dir you got from pear config-get>:$PATH

然后关闭并重新打开终端,或运行. ~/.profile

答案 1 :(得分:8)

因为我遇到了同样的问题,尽管phpunit安装成功(似乎)phpunit命令丢失了。经过一些研究后,我发现以下评论:How do I correctly install PHPUnit with PEAR?,所以之后:

$ sudo pear channel-discover pear.symfony.com # mind the difference!
$ sudo pear install --alldeps phpunit/PHPUnit

$ which phpunit
/usr/local/pear/bin/phpunit
一切顺利。

答案 2 :(得分:3)

  • pear卸载phpunit
  • pear channel-discover pear.phpunit.de
  • pear channel-discover components.ez.no
  • pear channel-discover pear.symfony-project.com
  • pear install phpunit / PHPUnit

如果我没记错的话,你还需要安装curl扩展才能安装phpunit。

泰瑞尔