Skip to content

Commit 1c73dfa

Browse files
authored
Merge pull request #222 from wp-cli/update-phpunit-bash-script
2 parents d210457 + 78e9e28 commit 1c73dfa

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

bin/run-php-unit-tests

+9-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@
33
# Run the unit tests, if they exist
44
if [ -f "phpunit.xml" ] || [ -f "phpunit.xml.dist" ] || [ -f ".phpunit.xml" ] || [ -f ".phpunit.xml.dist" ]
55
then
6+
PHPUNIT_VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')
7+
EXTRA_ARGS=""
8+
9+
if [ "${PHPUNIT_VERSION#11}" != "$PHPUNIT_VERSION" ] || [ "${PHPUNIT_VERSION#10}" != "$PHPUNIT_VERSION" ]; then
10+
EXTRA_ARGS="--display-warnings --fail-on-warning --display-notices --fail-on-notice --display-deprecations --fail-on-deprecation"
11+
fi
12+
613
if [ -f "./vendor/wp-cli/wp-cli-tests/tests/bootstrap.php" ]; then
7-
vendor/bin/phpunit --color=always "$@" --bootstrap ./vendor/wp-cli/wp-cli-tests/tests/bootstrap.php
14+
vendor/bin/phpunit --color=always "$@" $EXTRA_ARGS --bootstrap ./vendor/wp-cli/wp-cli-tests/tests/bootstrap.php
815
else
9-
vendor/bin/phpunit --color=always "$@"
16+
vendor/bin/phpunit --color=always "$@" $EXTRA_ARGS
1017
fi
1118
fi

0 commit comments

Comments
 (0)