Can now also test event code.

This commit is contained in:
James Cole
2017-04-27 08:26:58 +02:00
parent b26f3c0cc6
commit bbe40518e4
5 changed files with 151 additions and 17 deletions

22
test.sh
View File

@@ -10,13 +10,18 @@ TESTINGENV=./.env.testing
resetTestFlag=''
testflag=''
coverageflag=''
featureflag=''
featuretestclass=''
unitflag=''
unittestclass=''
verbalflag=''
testsuite=''
configfile='phpunit.xml';
while getopts 'vcrtf:s:' flag; do
while getopts 'vcrtf:u:s:' flag; do
case "${flag}" in
r)
resetTestFlag='true'
@@ -37,6 +42,11 @@ while getopts 'vcrtf:s:' flag; do
featuretestclass=./tests/Feature/$OPTARG
echo "Will only run Feature test $OPTARG"
;;
u)
unitflag='true'
unittestclass=./tests/Unit/$OPTARG
echo "Will only run Unit test $OPTARG"
;;
s)
testsuite="--testsuite $OPTARG"
echo "Will only run test suite '$OPTARG'"
@@ -45,7 +55,7 @@ while getopts 'vcrtf:s:' flag; do
esac
done
if [[ $coverageflag == "true" && $featureflag == "true" ]]
if [[ $coverageflag == "true" && ($featureflag == "true" || $unitflag == "true") ]]
then
echo "Use config file specific.xml"
configfile='phpunit.coverage.specific.xml'
@@ -109,12 +119,12 @@ else
then
echo "Must run PHPUnit without coverage:"
echo "phpunit $verbalflag --configuration $configfile $featuretestclass $testsuite"
phpunit $verbalflag --configuration $configfile $featuretestclass $testsuite
echo "phpunit $verbalflag --configuration $configfile $featuretestclass $unittestclass $testsuite"
phpunit $verbalflag --configuration $configfile $featuretestclass $unittestclass $testsuite
else
echo "Must run PHPUnit with coverage"
echo "phpunit $verbalflag --configuration $configfile $featuretestclass $testsuite"
phpunit $verbalflag --configuration $configfile $featuretestclass $testsuite
echo "phpunit $verbalflag --configuration $configfile $featuretestclass $unittestclass $testsuite"
phpunit $verbalflag --configuration $configfile $featuretestclass $unittestclass $testsuite
fi
fi