firefly-iii/cover.sh

63 lines
1.2 KiB
Bash
Raw Normal View History

2016-01-17 08:48:18 -06:00
#!/bin/bash
# set testing environment
cp .env.testing .env
# set cover:
cp phpunit.cover.xml phpunit.xml
2016-01-19 09:55:02 -06:00
# delete test databases:
if [ -f storage/database/testing.db ]
2016-01-17 08:48:18 -06:00
then
2016-02-23 09:15:26 -06:00
echo "Will not remove test db"
# rm storage/database/testing.db
2016-01-17 08:48:18 -06:00
fi
2016-01-19 09:55:02 -06:00
if [ -f storage/database/testing-copy.db ]
then
2016-02-23 09:15:26 -06:00
echo "Will not remove test db"
# rm storage/database/testing-copy.db
2016-01-19 09:55:02 -06:00
fi
# test!
2016-01-22 15:39:51 -06:00
if [ -z "$1" ]
then
echo "Running all tests..."
2016-02-23 09:15:26 -06:00
phpunit
2016-01-22 15:39:51 -06:00
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"
2016-02-23 09:15:26 -06:00
phpunit $firstFile
2016-01-24 08:55:48 -06:00
result=$?
2016-01-22 15:39:51 -06:00
fi
if [ -f "$secondFile" ]
then
# run it!
echo "Now running $secondFile"
2016-02-23 09:15:26 -06:00
phpunit $secondFile
2016-01-24 08:55:48 -06:00
result=$?
2016-01-22 15:39:51 -06:00
fi
done
fi
2016-01-17 08:48:18 -06:00
# restore .env file
cp .env.local .env
# restore cover
2016-01-24 08:55:48 -06:00
cp phpunit.default.xml phpunit.xml
exit ${result}