-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add a wrapper for PHPUnit binary
- Loading branch information
Showing
4 changed files
with
87 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
|
||
check_phpunit_version() { | ||
INSTALLED_PHPUNIT_VERSION=$(composer info phpunit/phpunit | grep versions | cut -c 14-) | ||
|
||
if [[ "${INSTALLED_PHPUNIT_VERSION}" == "${1?}"* ]]; then | ||
echo 1; | ||
else | ||
echo 0; | ||
fi | ||
} | ||
|
||
source .env | ||
|
||
if [ -f .env.local ]; then | ||
source .env.local | ||
fi | ||
|
||
EXTENSIONS="" | ||
|
||
if [ "${USE_DAMA_DOCTRINE_TEST_BUNDLE:-0}" = "1" ]; then | ||
EXTENSIONS="DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension" | ||
fi | ||
|
||
if [[ " 9 10 11 11.4 " != *" ${PHPUNIT_VERSION-9} "* ]]; then | ||
echo "❌ PHPUNIT_VERSION should be one of 9, 10, 11, 11.4"; | ||
exit 1; | ||
fi | ||
|
||
SHOULD_UPDATE_PHPUNIT=$(check_phpunit_version "${PHPUNIT_VERSION}") | ||
|
||
if [ "${SHOULD_UPDATE_PHPUNIT}" = "0" ]; then | ||
echo "ℹ️ Upgrading PHPUnit to ${PHPUNIT_VERSION}" | ||
if [ "${PHPUNIT_VERSION}" = "9" ]; then | ||
composer require symfony/phpunit-bridge phpunit/phpunit:^9 -W --dev | ||
else | ||
composer remove symfony/phpunit-bridge --dev | ||
|
||
if [ "${PHPUNIT_VERSION}" = "11.4" ]; then | ||
composer require phpunit/phpunit:11.4.x-dev -W --dev | ||
else | ||
composer require "phpunit/phpunit:^${PHPUNIT_VERSION}" -W --dev | ||
fi | ||
fi | ||
fi | ||
|
||
if [ "${PHPUNIT_VERSION}" = "9" ]; then | ||
CONFIGURATION_FILE="phpunit.xml.dist" | ||
else | ||
CONFIGURATION_FILE="phpunit-10.xml.dist" | ||
fi | ||
|
||
if [ -z "${EXTENSIONS}" ]; then | ||
vendor/bin/phpunit -c "${CONFIGURATION_FILE}" "$@" | ||
else | ||
vendor/bin/phpunit -c "${CONFIGURATION_FILE}" --extensions "${EXTENSIONS}" "$@" | ||
fi |
This file was deleted.
Oops, something went wrong.