diff --git a/docker-compose.yml b/docker-compose.yml index cc90fb8b..4f940b2c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,6 @@ services: volumes: - .:/app working_dir: /app - entrypoint: sh ./run-tests.sh php71: extends: service: base diff --git a/run-tests-for-all-php-versions.sh b/run-tests-for-all-php-versions.sh index 6ecd9afb..b64f01e4 100755 --- a/run-tests-for-all-php-versions.sh +++ b/run-tests-for-all-php-versions.sh @@ -1,44 +1,13 @@ #!/bin/bash -Help() -{ - # Display Help - echo "Runs PHPUnit tests for all PHP versions supported by this version of Smarty." - echo - echo "Syntax: $0 [-e|h]" - echo "options:" - echo "e Exclude a group of unit tests, e.g. -e 'slow'" - echo "h Print this Help." - echo -} - -Exclude="" - -# Get the options -while getopts ":he:" option; do - case $option in - e) # Exclude - echo $OPTARG - Exclude=$OPTARG;; - h) # display Help - Help - exit;; - \?) # Invalid option - echo "Error: Invalid option" - exit;; - esac -done - -if [ -z $Exclude ]; -then - Entrypoint="./run-tests.sh" -else - Entrypoint="./run-tests.sh $Exclude" -fi # Runs tests for all supported PHP versions -docker-compose run --entrypoint "$Entrypoint" php71 && \ -docker-compose run --entrypoint "$Entrypoint" php72 && \ -docker-compose run --entrypoint "$Entrypoint" php73 && \ -docker-compose run --entrypoint "$Entrypoint" php74 && \ -docker-compose run --entrypoint "$Entrypoint" php80 && \ -docker-compose run --entrypoint "$Entrypoint" php81 +# Usage examples: +# - ./run-tests-for-all-php-versions.sh --group 20221124 +# - ./run-tests-for-all-php-versions.sh --exclude-group slow + +docker-compose run php71 ./run-tests.sh $@ && \ +docker-compose run php72 ./run-tests.sh $@ && \ +docker-compose run php73 ./run-tests.sh $@ && \ +docker-compose run php74 ./run-tests.sh $@ && \ +docker-compose run php80 ./run-tests.sh $@ && \ +docker-compose run php81 ./run-tests.sh $@ diff --git a/run-tests.sh b/run-tests.sh index ddcad01b..1990a07f 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -1,13 +1,10 @@ #!/bin/sh -composer update -php -r 'echo "\nPHP version " . phpversion() . ". ";'; +# Runs composer update, echoes php version and runs PHPUnit +# Usage examples: +# - ./run-tests.sh --group 20221124 +# - ./run-tests.sh --exclude-group slow -if [ -z $1 ]; -then - echo "Running all unit tests.\n" - php ./vendor/phpunit/phpunit/phpunit -else - echo "Running all unit tests, except tests marked with @group $1.\n" - php ./vendor/phpunit/phpunit/phpunit --exclude-group $1 -fi \ No newline at end of file +composer update --quiet +#php -r 'echo "\nPHP version " . phpversion() . ". ";' +php ./vendor/phpunit/phpunit/phpunit $@