Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the Pear PHPUnit command

Tags:

pear

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

like image 511
Leahcim Avatar asked May 28 '11 01:05

Leahcim


3 Answers

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.

like image 173
John Flatness Avatar answered Oct 26 '22 01:10

John Flatness


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.

like image 25
Sleepless Annoyed Nerd Avatar answered Oct 26 '22 01:10

Sleepless Annoyed Nerd


  • 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

like image 28
Tyrael Avatar answered Oct 26 '22 01:10

Tyrael