From f085ccaa385ea5165081611bafa3f381d626145f Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Mon, 25 Apr 2022 18:26:30 +0900 Subject: [PATCH] update phpunit call script for testing --- 4dev/checking/phpunit.sh | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/4dev/checking/phpunit.sh b/4dev/checking/phpunit.sh index c92f1f17..b0ce4149 100755 --- a/4dev/checking/phpunit.sh +++ b/4dev/checking/phpunit.sh @@ -1,9 +1,37 @@ base="/storage/var/www/html/developers/clemens/core_data/php_libraries/trunk/"; # -c phpunit.xml # --testdox -# prefix with PHP bin to test different version -# /usr/bin/php7.3 -# /usr/bin/php7.4 -# /usr/bin/php8.0 -# /usr/bin/php8.1 -${base}www/vendor/bin/phpunit -c ${base}phpunit.xml ${base}4dev/tests/ +# call with "t" to give verbose testdox output +# call with 7.3, 7.4, 8.0, 8.1 to force a certain php version + +opt_testdox=""; +if [ "${1}" = "t" ] || [ "${2}" = "t" ]; then + opt_testdox="--testdox"; +fi; +php_bin=""; +case "${1}" in + "7.3") php_bin="/usr/bin/php7.3 "; ;; + "7.4") php_bin="/usr/bin/php7.4 "; ;; + "8.0") php_bin="/usr/bin/php8.0 "; ;; + "8.1") php_bin="/usr/bin/php8.1 "; ;; +esac; +if [ -z "${php_bin}" ]; then + case "${2}" in + "7.3") php_bin="/usr/bin/php7.3 "; ;; + "7.4") php_bin="/usr/bin/php7.4 "; ;; + "8.0") php_bin="/usr/bin/php8.0 "; ;; + "8.1") php_bin="/usr/bin/php8.1 "; ;; + esac; +fi; + +phpunit_call="${php_bin}${base}www/vendor/bin/phpunit ${opt_testdox} -c ${base}phpunit.xml ${base}4dev/tests/"; + +${phpunit_call}; + +if [ ! -z "${php_bin}" ]; then + echo "CALLED WITH PHP: ${php_bin}"$(${php_bin} --version); +else + echo "Default PHP used: "$(php --version); +fi; + +# __END__