mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-24 16:19:22 +00:00
Remove void return type when running tests on PHP 7.0
The void return type was implemented in PHP 7.1 and PHP 7.0 treats the
void return type as a class name.
Errors:
1) CurlTest\CurlTest::testExtensionsLoaded
TypeError: Return value of CurlTest\CurlTest::setUp() must be an instance of CurlTest\void, none returned
/home/runner/work/php-curl-class/php-curl-class/tests/PHPCurlClass/PHPCurlClassTest.php:18
2) CurlTest\CurlTest::testCaseInsensitiveArrayGet
TypeError: Return value of CurlTest\CurlTest::setUp() must be an instance of CurlTest\void, none returned
/home/runner/work/php-curl-class/php-curl-class/tests/PHPCurlClass/PHPCurlClassTest.php:18
3) CurlTest\CurlTest::testCaseInsensitiveArraySet
TypeError: Return value of CurlTest\CurlTest::setUp() must be an instance of CurlTest\void, none returned
/home/runner/work/php-curl-class/php-curl-class/tests/PHPCurlClass/PHPCurlClassTest.php:18
[...]
This commit is contained in:
+12
@@ -24,6 +24,14 @@ phpunit_v8_1_shim() {
|
||||
remove_expectWarning
|
||||
}
|
||||
|
||||
php_v7_0_shim() {
|
||||
# -protected function setUp(): void
|
||||
# +protected function setUp()
|
||||
find='protected function setUp(): void'
|
||||
replace='protected function setUp()'
|
||||
sed -i'' -e"s/${find}/${replace}/" "./PHPCurlClass/PHP"*
|
||||
}
|
||||
|
||||
set -x
|
||||
|
||||
composer self-update
|
||||
@@ -76,6 +84,10 @@ elif [[ "${phpunit_version}" == "8.1."* ]]; then
|
||||
phpunit_v8_1_shim
|
||||
fi
|
||||
|
||||
if [[ "${CI_PHP_VERSION}" == "7.0" ]]; then
|
||||
php_v7_0_shim
|
||||
fi
|
||||
|
||||
# Run tests.
|
||||
"${phpunit_to_use}" --version
|
||||
"${phpunit_to_use}" \
|
||||
|
||||
@@ -24,6 +24,14 @@ phpunit_v8_1_shim() {
|
||||
remove_expectWarning
|
||||
}
|
||||
|
||||
php_v7_0_shim() {
|
||||
# -protected function setUp(): void
|
||||
# +protected function setUp()
|
||||
find='protected function setUp(): void'
|
||||
replace='protected function setUp()'
|
||||
sed -i'' -e"s/${find}/${replace}/" "./PHPCurlClass/PHP"*
|
||||
}
|
||||
|
||||
set -x
|
||||
|
||||
# Use composer's phpunit and phpcs by adding composer bin directory to the path environment variable.
|
||||
@@ -73,6 +81,10 @@ elif [[ "${phpunit_version}" == "8.1."* ]]; then
|
||||
phpunit_v8_1_shim
|
||||
fi
|
||||
|
||||
if [[ "${CI_PHP_VERSION}" == "7.0" ]]; then
|
||||
php_v7_0_shim
|
||||
fi
|
||||
|
||||
# Run tests.
|
||||
extra_args="${@}"
|
||||
"${phpunit_to_use}" --version
|
||||
|
||||
Reference in New Issue
Block a user