Skip to content

Commit aa7bffa

Browse files
authored
Merge pull request php-curl-class#620 from zachborboa/619
Fix continuous integration tests for PHP 7.3.
2 parents fa3cfd3 + 8b15ec5 commit aa7bffa

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

tests/PHPCurlClass/PHPCurlClassTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ public function testMultipartFormDataContentType()
587587
"\r\n" .
588588
'bar' . "\r\n" .
589589
'';
590-
$this->assertContains($expected_contains, $test->curl->response);
590+
$this->assertStringContainsString($expected_contains, $test->curl->response);
591591
}
592592

593593
public function testPatchRequestMethod()
@@ -1456,6 +1456,8 @@ public function testJsonResponse()
14561456
*/
14571457
public function testJsonEncode()
14581458
{
1459+
$this->expectException(\ErrorException::class);
1460+
14591461
$data = array(
14601462
'malformed' => pack('H*', 'c32e'),
14611463
);
@@ -3031,6 +3033,8 @@ public function testClose()
30313033
*/
30323034
public function testRequiredOptionCurlOptReturnTransferEmitsWarning()
30333035
{
3036+
$this->expectWarning(\PHPUnit\Framework\Error\Warning::class);
3037+
30343038
$curl = new Curl();
30353039
$curl->setOpt(CURLOPT_RETURNTRANSFER, false);
30363040
}

tests/before_script.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ reload_nginx() {
3030
$superuser /etc/init.d/nginx restart
3131
}
3232

33+
php_v5_3_shim() {
34+
remove_double_colon_class_name_resolution
35+
}
36+
3337
phpunit_shim() {
3438
# -class CurlTest extends \PHPUnit\Framework\TestCase
3539
# +class CurlTest extends \PHPUnit_Framework_TestCase
@@ -51,6 +55,36 @@ phpunit_shim() {
5155
sed -i'' -e"s/${find}/${replace}/" "$(pwd)/tests/PHPCurlClass/PHP"*
5256
}
5357

58+
remove_double_colon_class_name_resolution() {
59+
sed -i'' -e"/::class/d" "$(pwd)/tests/PHPCurlClass/PHP"*
60+
}
61+
62+
remove_expectWarning() {
63+
# Fix "Call to undefined method CurlTest\CurlTest::expectWarning()".
64+
sed -i'' -e"/->expectWarning(/d" "$(pwd)/tests/PHPCurlClass/PHP"*
65+
}
66+
67+
replace_assertStringContainsString() {
68+
# -->assertStringContainsString(
69+
# +->assertContains(
70+
find='->assertStringContainsString('
71+
replace='->assertContains('
72+
sed -i'' -e"s/${find}/${replace}/" "$(pwd)/tests/PHPCurlClass/PHP"*
73+
}
74+
75+
phpunit_v4_8_shim() {
76+
replace_assertStringContainsString
77+
}
78+
79+
phpunit_v6_5_shim() {
80+
remove_expectWarning
81+
replace_assertStringContainsString
82+
}
83+
84+
phpunit_v7_5_shim() {
85+
remove_expectWarning
86+
}
87+
5488
set -x
5589
echo "TRAVIS_PHP_VERSION: ${TRAVIS_PHP_VERSION}"
5690
php -r "var_dump(phpversion());"
@@ -107,6 +141,8 @@ EOF
107141
$superuser /etc/init.d/php5-fpm start
108142
reload_nginx
109143
phpunit_shim
144+
phpunit_v4_8_shim
145+
php_v5_3_shim
110146
elif [[ "${TRAVIS_PHP_VERSION}" == "5.4" ]]; then
111147
install_nginx
112148
use_php_fpm
@@ -123,8 +159,10 @@ elif [[ "${TRAVIS_PHP_VERSION}" == "5.6" ]]; then
123159
reload_nginx
124160
phpunit_shim
125161
elif [[ "${TRAVIS_PHP_VERSION}" == "7.0" ]]; then
162+
phpunit_v6_5_shim
126163
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &
127164
elif [[ "${TRAVIS_PHP_VERSION}" == "7.1" ]]; then
165+
phpunit_v7_5_shim
128166
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &
129167
elif [[ "${TRAVIS_PHP_VERSION}" == "7.2" ]]; then
130168
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &

0 commit comments

Comments
 (0)