Improving Makefile and PHPUNIT dependency on composer.json

This commit is contained in:
Bruno F. Fontes 2019-06-28 02:21:55 -03:00
parent 92409b9571
commit 37ebdabc20
3 changed files with 15 additions and 4 deletions

View File

@ -1,8 +1,10 @@
install: install:
composer update command -v composer && composer install || echo "Please, install Composer to use tests"
command -v phpunit || command -v composer && composer require --dev phpunit/phpunit ^8
chmod +x ./pre-push.sh chmod +x ./pre-push.sh
mkdir -p .git/hooks mkdir -p .git/hooks
ln -fs ../../pre-push.sh .git/hooks/pre-push ln -fs ../../pre-push.sh .git/hooks/pre-push
uninstall: uninstall:
rm -f ./.git/hooks/pre-push rm -f ./.git/hooks/pre-push
if [ -d "./vendor/phpunit" ] ; then composer remove --dev phpunit/phpunit; fi

View File

@ -22,6 +22,5 @@
} }
], ],
"require-dev": { "require-dev": {
"phpunit/phpunit": "^8.2"
} }
} }

View File

@ -1 +1,11 @@
./vendor/phpunit/phpunit/phpunit --bootstrap vendor/autoload.php tests --testdox --color params="--bootstrap vendor/autoload.php tests --testdox --color"
if [ $(command -v phpunit) ]; then
phpunit $params
else
if [ -d ./vendor/phpunit ]; then
./vendor/phpunit/phpunit/phpunit $params
else
echo "Please, run 'make install' or install phpunit globally to run the tests"
fi
fi