Where is the Pear PHPUnit command
As you see in the image below, I have Pear installed, and there is a PhpUnit folder, but when I run this code (from a book on Yii),
% phpunit functional/SiteTest.php
it's telling me
-bash: phpunit: command not found
I am assuming from the fact that Phpunit folder is present that I have correctly installed it. In fact, it said install o.k. in the termi开发者_如何学Cnal.
Any ideas where I can find this command?
Running
pear config-get bin_dir
will tell you the location where PEAR installs executables (like phpunit
) to.
Having gotten the directory name, you want to add it to your PATH. One way to do this is to edit the .profile
file in your home directory (it's hidden), and add the following line:
export PATH=<dir you got from pear config-get>:$PATH
and then either close and re-open your terminal, or run . ~/.profile
.
Since I had the same problem although phpunit installed successfully (it seemed) phpunit
command was missing. After some research I found following comment: How do I correctly install PHPUnit with PEAR?, so after:
$ sudo pear channel-discover pear.symfony.com # mind the difference!
$ sudo pear install --alldeps phpunit/PHPUnit
$ which phpunit
/usr/local/pear/bin/phpunit
everything worked.
- pear uninstall phpunit
- pear channel-discover pear.phpunit.de
- pear channel-discover components.ez.no
- pear channel-discover pear.symfony-project.com
- pear install phpunit/PHPUnit
and if I remember correctly you also need to install the curl extension to be able to install phpunit.
Tyrael
精彩评论