Merge pull request #620 from zachborboa/619

Fix continuous integration tests for PHP 7.3.
This commit is contained in:
Zach Borboa
2020-02-17 16:17:30 -08:00
committed by GitHub
2 changed files with 43 additions and 1 deletions
+5 -1
View File
@@ -587,7 +587,7 @@ class CurlTest extends \PHPUnit\Framework\TestCase
"\r\n" .
'bar' . "\r\n" .
'';
$this->assertContains($expected_contains, $test->curl->response);
$this->assertStringContainsString($expected_contains, $test->curl->response);
}
public function testPatchRequestMethod()
@@ -1456,6 +1456,8 @@ class CurlTest extends \PHPUnit\Framework\TestCase
*/
public function testJsonEncode()
{
$this->expectException(\ErrorException::class);
$data = array(
'malformed' => pack('H*', 'c32e'),
);
@@ -3031,6 +3033,8 @@ class CurlTest extends \PHPUnit\Framework\TestCase
*/
public function testRequiredOptionCurlOptReturnTransferEmitsWarning()
{
$this->expectWarning(\PHPUnit\Framework\Error\Warning::class);
$curl = new Curl();
$curl->setOpt(CURLOPT_RETURNTRANSFER, false);
}
+38
View File
@@ -30,6 +30,10 @@ reload_nginx() {
$superuser /etc/init.d/nginx restart
}
php_v5_3_shim() {
remove_double_colon_class_name_resolution
}
phpunit_shim() {
# -class CurlTest extends \PHPUnit\Framework\TestCase
# +class CurlTest extends \PHPUnit_Framework_TestCase
@@ -51,6 +55,36 @@ phpunit_shim() {
sed -i'' -e"s/${find}/${replace}/" "$(pwd)/tests/PHPCurlClass/PHP"*
}
remove_double_colon_class_name_resolution() {
sed -i'' -e"/::class/d" "$(pwd)/tests/PHPCurlClass/PHP"*
}
remove_expectWarning() {
# Fix "Call to undefined method CurlTest\CurlTest::expectWarning()".
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_v4_8_shim() {
replace_assertStringContainsString
}
phpunit_v6_5_shim() {
remove_expectWarning
replace_assertStringContainsString
}
phpunit_v7_5_shim() {
remove_expectWarning
}
set -x
echo "TRAVIS_PHP_VERSION: ${TRAVIS_PHP_VERSION}"
php -r "var_dump(phpversion());"
@@ -107,6 +141,8 @@ EOF
$superuser /etc/init.d/php5-fpm start
reload_nginx
phpunit_shim
phpunit_v4_8_shim
php_v5_3_shim
elif [[ "${TRAVIS_PHP_VERSION}" == "5.4" ]]; then
install_nginx
use_php_fpm
@@ -123,8 +159,10 @@ 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
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &
elif [[ "${TRAVIS_PHP_VERSION}" == "7.2" ]]; then
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &