mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-09 04:44:26 +02:00
Simplify test running to support all phpunit cmdline options
This commit is contained in:
@@ -7,7 +7,6 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
working_dir: /app
|
working_dir: /app
|
||||||
entrypoint: sh ./run-tests.sh
|
|
||||||
php71:
|
php71:
|
||||||
extends:
|
extends:
|
||||||
service: base
|
service: base
|
||||||
|
@@ -1,44 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/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
|
# Runs tests for all supported PHP versions
|
||||||
docker-compose run --entrypoint "$Entrypoint" php71 && \
|
# Usage examples:
|
||||||
docker-compose run --entrypoint "$Entrypoint" php72 && \
|
# - ./run-tests-for-all-php-versions.sh --group 20221124
|
||||||
docker-compose run --entrypoint "$Entrypoint" php73 && \
|
# - ./run-tests-for-all-php-versions.sh --exclude-group slow
|
||||||
docker-compose run --entrypoint "$Entrypoint" php74 && \
|
|
||||||
docker-compose run --entrypoint "$Entrypoint" php80 && \
|
docker-compose run php71 ./run-tests.sh $@ && \
|
||||||
docker-compose run --entrypoint "$Entrypoint" php81
|
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 $@
|
||||||
|
17
run-tests.sh
17
run-tests.sh
@@ -1,13 +1,10 @@
|
|||||||
#!/bin/sh
|
#!/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 ];
|
composer update --quiet
|
||||||
then
|
#php -r 'echo "\nPHP version " . phpversion() . ". ";'
|
||||||
echo "Running all unit tests.\n"
|
php ./vendor/phpunit/phpunit/phpunit $@
|
||||||
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
|
|
||||||
|
Reference in New Issue
Block a user