[TOOLS] Allow specifying a list of filters when running tests with make. When running make test foobar only the test foobar is executed (read the documentation for phpunit --filter)

This commit is contained in:
Hugo Sales 2021-10-28 17:24:43 +01:00
parent a55d60d880
commit 8238980395
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
2 changed files with 15 additions and 2 deletions

View File

@ -1,6 +1,11 @@
DIR=$(strip $(notdir $(CURDIR))) # Seems a bit hack-ish, but `basename` works differently DIR=$(strip $(notdir $(CURDIR))) # Seems a bit hack-ish, but `basename` works differently
translate-container-name = $$(if docker container inspect $(1) > /dev/null 2>&1; then echo $(1); else echo $(1) | sed 'y/_/-/' ; fi) translate-container-name = $$(if docker container inspect $(1) > /dev/null 2>&1; then echo $(1); else echo $(1) | sed 'y/_/-/' ; fi)
args = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}`
%:
@:
.PHONY: .PHONY:
@if ! docker info > /dev/null; then echo "Docker does not seem to be running"; exit 1; fi @if ! docker info > /dev/null; then echo "Docker does not seem to be running"; exit 1; fi
@ -30,7 +35,7 @@ tooling-docker: .PHONY
@cd docker/tooling && docker-compose up -d > /dev/null 2>&1 @cd docker/tooling && docker-compose up -d > /dev/null 2>&1
test: tooling-docker test: tooling-docker
docker exec $(call translate-container-name,tooling_php_1) /var/tooling/coverage.sh docker exec $(call translate-container-name,tooling_php_1) /var/tooling/coverage.sh $(call args,defaultstring)
doc-check: doc-check:
bin/php-doc-check src components plugins bin/php-doc-check src components plugins

View File

@ -2,6 +2,14 @@
cd /var/www/social || exit 1 cd /var/www/social || exit 1
printf "Cleaning Redis cache: " && echo "FLUSHALL" | nc redis 6379
yes yes | php bin/console doctrine:fixtures:load || exit 1 yes yes | php bin/console doctrine:fixtures:load || exit 1
echo yooo
if [ "$#" -eq 0 ]; then
runuser -u www-data -- vendor/bin/simple-phpunit -vvv --coverage-html .test_coverage_report runuser -u www-data -- vendor/bin/simple-phpunit -vvv --coverage-html .test_coverage_report
else
echo "Running with filter"
runuser -u www-data -- vendor/bin/simple-phpunit -vvv --coverage-html .test_coverage_report --filter "$*"
fi