Better scripts (accept arguments)

This commit is contained in:
James Cole
2016-01-22 22:39:51 +01:00
parent 7b040e8583
commit d672f0c2ad
2 changed files with 67 additions and 2 deletions

35
pu.sh
View File

@@ -23,7 +23,40 @@ then
fi
# test!
phpunit
if [ -z "$1" ]
then
echo "Running all tests..."
phpunit
fi
# test selective..
dirs=("acceptance/Controllers" "acceptance/Controllers/Auth" "acceptance/Controllers/Chart" "unit")
#
if [ ! -z "$1" ]
then
for i in "${dirs[@]}"
do
firstFile="./tests/$i/$1.php"
secondFile="./tests/$i/$1Test.php"
if [ -f "$firstFile" ]
then
# run it!
echo "Now running $firstFile"
phpunit --verbose $firstFile
exit $?
fi
if [ -f "$secondFile" ]
then
# run it!
echo "Now running $secondFile"
phpunit --verbose $secondFile
exit $?
fi
done
fi
# restore .env file
cp .env.local .env