Created
April 18, 2013 13:07
-
-
Save johnpbloch/5412545 to your computer and use it in GitHub Desktop.
Install PHPUnit globally with composer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "phpunit", | |
"description": "PHPUnit Composer Package", | |
"require": { | |
"phpunit/phpunit": "3.7.*" | |
}, | |
"config": { | |
"bin-dir": "/usr/local/bin/" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.