shell/install/phpunit
2023-03-10 13:55:10 +08:00

32 lines
748 B
Bash
Executable File

#!/bin/bash
##makedesc: Install phpunit
echo
echo "==============================================="
echo "Installing phpunit..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
! installed 'php' && echo 'ERROR: You need php to be installed' && exit 1
! installed "composer" && echo "ERROR: You rneed composer to be installed" && exit 2
COMPOSER_GLOBAL_HOME="$(composer config -g home)"
NEWPATH="export PATH=\"$COMPOSER_GLOBAL_HOME/vendor/bin:\${PATH}\""
cat "${HOME}/.profile" | grep -qoh "$NEWPATH" || {
$NEWPATH
echo "$NEWPATH" >> "${HOME}/.profile"
}
source "${HOME}/.profile"
composer global require phpunit/phpunit --dev
echo
echo "Finish!"
echo
phpunit --version