Where is the Pear PHPUnit command

Leahcim picture Leahcim · May 28, 2011 · Viewed 7.9k times · Source

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 terminal.

Any ideas where I can find this command?

enter image description here

Answer

John Flatness picture John Flatness · May 28, 2011

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.