From 535cf0b3bd14c52dcd2a9b0091cc1da7c0f3e43b Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Mon, 9 Sep 2024 18:48:02 +1200 Subject: [PATCH] ENH Show deprecations in phpunit 11.3.3 and above --- action.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index fba423c..35ba0bd 100644 --- a/action.yml +++ b/action.yml @@ -77,12 +77,20 @@ runs: PHPUNIT_SUITE: ${{ inputs.phpunit_suite }} run: | PHPUNIT_OPTIONS="--colors=always" - [[ $(vendor/bin/phpunit --version) =~ ([0-9]+)\.[0-9]+\.[0-9] ]] - PHPUNIT_MAJOR_VERSION=${BASH_REMATCH[1]} - if (( "$PHPUNIT_MAJOR_VERSION" <= 9 )); then + [[ $(vendor/bin/phpunit --version) =~ ([0-9]+)\.([0-9]+)\.([0-9]+) ]] + MAJOR=${BASH_REMATCH[1]} + MINOR=${BASH_REMATCH[2]} + PATCH=${BASH_REMATCH[3]} + INT_VERSION=$(( $MAJOR * 10000 + $MINOR * 100 + $PATCH )) + if (( "$INT_VERSION" < 100000 )); then # --verbose option removed in PHPUnit 10, as it's now always verbose PHPUNIT_OPTIONS="$PHPUNIT_OPTIONS --verbose" fi + # --display-phpunit-deprecations option added in PHPUnit 11.3.3 + # deprecations will display by default in PHPUnit <= 11.3.2 + if (( "$INT_VERSION" >= 110303 )); then + PHPUNIT_OPTIONS="$PHPUNIT_OPTIONS --display-phpunit-deprecations" + fi if [[ "$PHPUNIT_SUITE" != "all" ]] && [[ "$PHPUNIT_SUITE" != "" ]]; then PHPUNIT_OPTIONS="$PHPUNIT_OPTIONS --testsuite "$PHPUNIT_SUITE"" fi