Skeletons for test

This commit is contained in:
James Cole
2016-11-19 20:30:30 +01:00
parent 5d901a7ecb
commit 26190524f4
50 changed files with 4433 additions and 9 deletions

28
test.sh
View File

@@ -7,13 +7,15 @@ BACKUPENV=./.env.current
TESTINGENV=./.env.testing
# do something with flags:
rflag=''
tflag=''
resetestflag=''
testflag=''
coverageflag=''
while getopts 'rt' flag; do
while getopts 'crt' flag; do
case "${flag}" in
r) rflag='true' ;;
t) tflag='true' ;;
r) resetestflag='true' ;;
t) testflag='true' ;;
c) coverageflag='true' ;;
*) error "Unexpected option ${flag}" ;;
esac
done
@@ -32,7 +34,7 @@ cp $TESTINGENV $ORIGINALENV
php artisan cache:clear
# reset database (optional)
if [[ $rflag == "true" ]]
if [[ $resetestflag == "true" ]]
then
echo "Must reset database"
@@ -51,7 +53,7 @@ then
fi
# do not reset database (optional)
if [[ $rflag == "" ]]
if [[ $resetestflag == "" ]]
then
echo "Will not reset database"
fi
@@ -60,12 +62,20 @@ fi
cp $DATABASECOPY $DATABASE
# run PHPUnit
if [[ $tflag == "" ]]
if [[ $testflag == "" ]]
then
echo "Must not run PHPUnit"
else
echo "Must run PHPUnit"
phpunit
if [[ $coverageflag == "" ]]
then
echo "Must run PHPUnit without coverage"
phpunit
else
echo "Must run PHPUnit with coverage"
phpunit --configuration phpunit.coverage.xml
fi
fi
# restore current config: