From faf270418c5f04a20e34482b1ba629cbbc70d008 Mon Sep 17 00:00:00 2001 From: Gary Jones Date: Mon, 30 Jan 2023 14:15:58 +0000 Subject: [PATCH] Unit tests: Fix PHPUnit deprecation When running the unit tests with PHP 8.1 or above, PHPUnit would give a deprecation notice: > PHP Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in .../vipcs/vendor/phpunit/phpunit/src/Util/Getopt.php on line 159 The tests still ran successfully though. This notice originated from the use of `--filter WordPressVIPMinimum`, and was fixed by adding an equals sign: `--filter=WordPressVIPMinimum`. Under both versions, the same number of tests and test files and unique error codes were created. --- bin/unit-tests | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/unit-tests b/bin/unit-tests index 0c84e924..8ffc5acc 100755 --- a/bin/unit-tests +++ b/bin/unit-tests @@ -17,7 +17,7 @@ # if [[ $(php -r 'echo PHP_VERSION_ID;') -ge 80100 ]]; then - "$(pwd)/vendor/bin/phpunit" --filter WordPressVIPMinimum "$(pwd)/vendor/squizlabs/php_codesniffer/tests/AllTests.php" --no-coverage --no-configuration --bootstrap=./tests/bootstrap.php --dont-report-useless-tests $@ + "$(pwd)/vendor/bin/phpunit" --filter=WordPressVIPMinimum "$(pwd)/vendor/squizlabs/php_codesniffer/tests/AllTests.php" --no-coverage --no-configuration --bootstrap=./tests/bootstrap.php --dont-report-useless-tests $@ else - "$(pwd)/vendor/bin/phpunit" --filter WordPressVIPMinimum "$(pwd)/vendor/squizlabs/php_codesniffer/tests/AllTests.php" --no-coverage $@ + "$(pwd)/vendor/bin/phpunit" --filter=WordPressVIPMinimum "$(pwd)/vendor/squizlabs/php_codesniffer/tests/AllTests.php" --no-coverage $@ fi