I have a bash method:
SUITE=''
FILTER=''
COVERAGE=''
COVERAGE_REPORT_PATH="tests/Report"
while getopts :s:f:c: flag # do not remove first colon as it makes flags optional
do
case "${flag}" in
s) SUITE="--testsuite=${OPTARG}";;
f) FILTER="--filter=${OPTARG}";;
c) COVERAGE="--coverage-html ${COVERAGE_REPORT_PATH}";;
esac
done
echo "docker exec -it my_api_1 ./vendor/bin/phpunit ${SUITE} ${FILTER} ${COVERAGE}";
When I run it with: ./local.sh phpunit -s Unit
it prints:
docker exec -it my_api_1 ./vendor/bin/phpunit --testsuite=Unit
When I run it with: ./local.sh phpunit -f MyClass
it prints:
docker exec -it my_api_1 ./vendor/bin/phpunit --filter=MyClass
But when I run it with both flags: ./local.sh phpunit -s Unit -f MyClass
it only prints the first one:
docker exec -it my_api_1 ./vendor/bin/phpunit --testsuite=Unit
What am I doing wrong?