Fix tests running with older versions of PHPUnit

This commit is contained in:
Zach Borboa
2021-03-23 23:08:08 -04:00
parent e1ff6e870d
commit 922ff9bdc8
+22 -2
View File
@@ -20,6 +20,10 @@ phpunit_v7_5_shim() {
remove_expectWarning
}
phpunit_v8_1_shim() {
remove_expectWarning
}
start_php_servers() {
for i in $(seq 0 6); do
port=8000
@@ -39,11 +43,27 @@ composer install --prefer-source --no-interaction
# Let test server know we should allow testing.
export PHP_CURL_CLASS_TEST_MODE_ENABLED="yes"
if [[ "${CI_PHP_VERSION}" == "7.0" ]]; then
# Determine which phpunit to use.
if [[ -f "../vendor/bin/phpunit" ]]; then
phpunit_to_use="../vendor/bin/phpunit"
else
phpunit_to_use="phpunit"
fi
phpunit_version="$("${phpunit_to_use}" --version | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")"
echo "${phpunit_version}"
if [[ "${phpunit_version}" == "6.5."* ]]; then
phpunit_v6_5_shim
elif [[ "${phpunit_version}" == "7.5."* ]]; then
phpunit_v7_5_shim
elif [[ "${phpunit_version}" == "8.1."* ]]; then
phpunit_v8_1_shim
fi
if [[ "${CI_PHP_VERSION}" == "7.0" ]]; then
start_php_servers
elif [[ "${CI_PHP_VERSION}" == "7.1" ]]; then
phpunit_v7_5_shim
start_php_servers
elif [[ "${CI_PHP_VERSION}" == "7.2" ]]; then
start_php_servers