0

I have installed composer globally on my Ubuntu12.04 machine.

I can confirm it because it is in the ~/.composer/vendor directory and is included in global composer.json.

My problem is whenever I try to run phpunit it gives the following

The program 'phpunit' is currently not installed.  You can install it by typing: 
sudo apt-get install phpunit

EDIT:

I am following the instructions found here

  • I would assume phpunit is not on your path. You can confirm this with the command which phpunit it won't be found if it's not on your path. – Elder Geek Mar 25 '15 at 16:07
  • 1
    Then you should try it: sudo apt-get install phpunit – A.B. Mar 25 '15 at 16:08
  • @ElderGeek tried which phpunit but there was not output on my terminal – lozadaOmr Mar 25 '15 at 16:09
  • If it was installed globally, your system would have caught that already. Exactly how did you install it? – Faron Mar 25 '15 at 16:12
  • @Faron I used this command composer global require "phpunit/phpunit=4.5.*" – lozadaOmr Mar 25 '15 at 16:13
1

You may have skipped sudo mv phpunit.phar /usr/local/bin/phpunit when following the instructions.

the result is that phpunit is not on your path.

You have 2 choices.

1) Do the step you missed, (recommended)

2) Hack things in such a way that phpunit is found on your path by another method.

If any of this is unclear, drop me a comment and I'll do my best to elaborate.

| improve this answer | |
  • By path did you mean /usr/local/bin? – lozadaOmr Mar 25 '15 at 16:19
  • 1
    Based on the instructions you say you followed and the command I think you skipped, the file phpunit.phar is moved to /usr/local/bin which should be on your path and renamed to phpunit simultaneously. this will allow running phpunit from the command line. – Elder Geek Mar 25 '15 at 16:23
  • This is weird that installing it globally using composer didn't work for me. So I just followed your previous comment, and used the phpunit.phar, thanks – lozadaOmr Mar 25 '15 at 16:34
  • It's not that strange that skipping a key command in the instructions would result in a problem. Regardless, I'm glad your problem is resolved. :-) – Elder Geek Mar 25 '15 at 16:36
  • 1
    Just to add, once you have the phpunit.phar you don't need to install it globally using composer. – lozadaOmr Mar 25 '15 at 16:41
0

If which does not return a path, it means that your system is not seeing it at all, which also means that phpunit is not globally recognized and is not part of system's PATH.

To have it to be recognized, you need to have it to be inside the system as top level. Best shot is to execute this command sudo apt-get install phpunit. Always use this command as it'll save your headache.

But if you are installing a package that isn't available in apt-get repository, then you will want to configure the package for a specific path. ./configure --path=/usr or ./configure --path=/usr/share.

Avoid using /usr/local.

Hope you tackle this down. Good luck.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.