From d672f0c2ad974b34b4d1cd28b4a326ed11a1ccb2 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 22 Jan 2016 22:39:51 +0100 Subject: [PATCH] Better scripts (accept arguments) --- cover.sh | 34 +++++++++++++++++++++++++++++++++- pu.sh | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/cover.sh b/cover.sh index d492b09735..8b085fce28 100755 --- a/cover.sh +++ b/cover.sh @@ -18,7 +18,39 @@ then fi # test! -phpdbg -qrr /usr/local/bin/phpunit +if [ -z "$1" ] +then + echo "Running all tests..." + phpunit --verbose +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 diff --git a/pu.sh b/pu.sh index a240909d0e..f3f73b9540 100755 --- a/pu.sh +++ b/pu.sh @@ -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