Fix tests running with older versions of PHPUnit

This commit is contained in:
Zach Borboa
2021-06-10 11:23:46 -04:00
parent 2198e05909
commit 13a04102b5
+22 -2
View File
@@ -85,6 +85,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
@@ -117,6 +121,24 @@ fi
# Let test server know we should allow testing.
export PHP_CURL_CLASS_TEST_MODE_ENABLED="yes"
# 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}" == "5.3" ]]; then
if ! [ -x "$(command -v add-apt-repository)" ]; then
$superuser apt-get install -y python-software-properties
@@ -167,10 +189,8 @@ elif [[ "${CI_PHP_VERSION}" == "5.6" ]]; then
reload_nginx
phpunit_shim
elif [[ "${CI_PHP_VERSION}" == "7.0" ]]; then
phpunit_v6_5_shim
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