Skip to content

Firefly III: a personal finances manager

Better scripts (accept arguments)

James Coled672f0c2ad97
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