Fix continuous integration tests for PHP 7.0.

There was 1 error:
    1) CurlTest\CurlTest::testMultipartFormDataContentType
    Error: Call to undefined method CurlTest\CurlTest::assertStringContainsString()
    ./tests/PHPCurlClass/PHPCurlClassTest.php:590

There was 1 failure:
    1) CurlTest\CurlTest::testRequiredOptionCurlOptReturnTransferEmitsWarning
    Failed asserting that exception of type "Error" matches expected exception "\PHPUnit\Framework\Error\Warning".
    Message was: "Call to undefined method CurlTest\CurlTest::expectWarning()" at
    ./tests/PHPCurlClass/PHPCurlClassTest.php:3036
This commit is contained in:
Zach Borboa
2020-02-17 15:28:31 -08:00
parent 702e4a13ea
commit 947848bd2a
+20 -2
View File
@@ -51,9 +51,26 @@ phpunit_shim() {
sed -i'' -e"s/${find}/${replace}/" "$(pwd)/tests/PHPCurlClass/PHP"*
}
phpunit_v7_5_shim() {
remove_expectWarning() {
# Fix "Call to undefined method CurlTest\CurlTest::expectWarning()".
sed -i'' -e"/->expectWarning(/d" "$(pwd)/tests/PHPCurlClass/PHPCurlClassTest.php"
sed -i'' -e"/->expectWarning(/d" "$(pwd)/tests/PHPCurlClass/PHP"*
}
replace_assertStringContainsString() {
# -->assertStringContainsString(
# +->assertContains(
find='->assertStringContainsString('
replace='->assertContains('
sed -i'' -e"s/${find}/${replace}/" "$(pwd)/tests/PHPCurlClass/PHP"*
}
phpunit_v6_5_shim() {
remove_expectWarning
replace_assertStringContainsString
}
phpunit_v7_5_shim() {
remove_expectWarning
}
set -x
@@ -128,6 +145,7 @@ elif [[ "${TRAVIS_PHP_VERSION}" == "5.6" ]]; then
reload_nginx
phpunit_shim
elif [[ "${TRAVIS_PHP_VERSION}" == "7.0" ]]; then
phpunit_v6_5_shim
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &
elif [[ "${TRAVIS_PHP_VERSION}" == "7.1" ]]; then
phpunit_v7_5_shim