From 947848bd2a05a92a8ef34cb98446b72cb4f9a61f Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Mon, 17 Feb 2020 15:28:31 -0800 Subject: [PATCH] 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 --- tests/before_script.sh | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/before_script.sh b/tests/before_script.sh index d05fe55..ac9f352 100755 --- a/tests/before_script.sh +++ b/tests/before_script.sh @@ -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