Skip to content

Instantly share code, notes, and snippets.

@johnpbloch
Created April 18, 2013 13:07
Show Gist options
  • Save johnpbloch/5412545 to your computer and use it in GitHub Desktop.
Save johnpbloch/5412545 to your computer and use it in GitHub Desktop.
Install PHPUnit globally with composer
{
"name": "phpunit",
"description": "PHPUnit Composer Package",
"require": {
"phpunit/phpunit": "3.7.*"
},
"config": {
"bin-dir": "/usr/local/bin/"
}
}
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
mkdir -p /usr/local/lib/phpunit
mv composer.json /usr/local/lib/phpunit
cd /usr/local/lib/phpunit
if [ `which composer` ]; then
composer install
else
if [ ! -f './composer.phar' ]; then
curl -sS https://getcomposer.org/installer | php
fi
php composer.phar install
fi
@edpittol
Copy link

edpittol commented Jan 4, 2014

You can add this line:

ln -s /usr/local/lib/phpunit/vendor/phpunit/phpunit/composer/bin/phpunit /usr/bin/phpunit

Its permit to execute the phpunit without pass all path off the bin file in the command line.

@i3or1s
Copy link

i3or1s commented Jul 28, 2014

@devrkd
Copy link

devrkd commented Aug 6, 2019

Thanks @johnpbloch for such a simple script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment