Hello everyone!

We have been investing plenty of personal time and energy for many years to share our knowledge with you all. However, we now need your help to keep this blog running. All you have to do is just click one of the adverts on the site, otherwise it will sadly be taken down due to hosting etc. costs. Thank you.

This post shows you how to install phpunit globally so that you and your applications can access it from anywhere while running tests.


Current status


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

Get package


inanzzz@inanzzz:~$ wget https://phar.phpunit.de/phpunit.phar
--2015-03-27 19:46:12-- https://phar.phpunit.de/phpunit.phar
Resolving phar.phpunit.de (phar.phpunit.de)... 188.94.27.25
Connecting to phar.phpunit.de (phar.phpunit.de)|188.94.27.25|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3411356 (3.3M) [application/octet-stream]
Saving to: ‘phpunit.phar’

100%[==============================================================================>] 3,411,356 881KB/s in 3.9s

2015-03-27 19:46:17 (846 KB/s) - ‘phpunit.phar’ saved [3411356/3411356]

Grant executable permissions


inanzzz@inanzzz:~$ chmod +x phpunit.phar

Move


Path /usr/local/bin/ is for programs that user can run.


inanzzz@inanzzz:~$ sudo mv phpunit.phar /usr/local/bin/phpunit
[sudo] password for inanzzz:

Check


inanzzz@inanzzz:~$ phpunit --version
PHPUnit 4.5.0 by Sebastian Bergmann and contributors.