Skip to content

Commit ee83267

Browse files
Fix test for php7.0
1 parent cf1993b commit ee83267

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

lib/HttpClient/CurlClient.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,7 @@ public function executeStreamingRequestWithRetries($opts, $absUrl, $readBodyChun
390390
&$numRetries,
391391
&$rcode,
392392
&$lastRHeaders,
393-
&$errno,
394-
&$message
393+
&$errno
395394
) {
396395
$lastRHeaders = $rheaders;
397396
$errno = \curl_errno($this->curlHandle);

tests/Stripe/HttpClient/CurlClientTest.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,12 @@ public function tearDownTestServer()
381381
// if this flakes.
382382
public function testExecuteRequestWithRetriesCallsWriteFunctionWithChunks()
383383
{
384-
$chunk1 = 'First, bytes';
385-
$chunk2 = 'more bytes';
386-
$chunk3 = 'final bytes';
384+
$chunk1 = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
385+
$chunk2 = 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb';
386+
$chunk3 = 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc';
387387
$serverCode = <<<EOF
388388
<?php
389+
ob_end_flush();
389390
echo "{$chunk1}";
390391
ob_flush();
391392
flush();
@@ -492,7 +493,7 @@ public function testExecuteStreamingRequestWithRetriesPersistentConnection()
492493
$curl = new CurlClient();
493494
$coupon = \Stripe\Coupon::retrieve('coupon_xyz');
494495

495-
$absUrl = \Stripe\Stripe::$apiBase . "/v1/coupons/xyz";
496+
$absUrl = \Stripe\Stripe::$apiBase . '/v1/coupons/xyz';
496497
$opts[\CURLOPT_HTTPGET] = 1;
497498
$opts[\CURLOPT_URL] = $absUrl;
498499
$opts[\CURLOPT_HTTPHEADER] = ['Authorization: Basic c2tfdGVzdF94eXo6'];

tests/TestServer.php

+10-11
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,18 @@ trait TestServer
2424
// value to `stripe-mock`'s standard 12111.
2525
protected $serverPort = 12113;
2626

27-
2827
private function lint($path)
2928
{
30-
$output = '';
31-
$exitCode = null;
32-
\exec("php -l {$path}", $output, $exitCode);
33-
if (0 !== $exitCode) {
34-
$text = \implode("\n", $output);
35-
throw new \Exception("Error in test server code: {$text}");
36-
}
29+
$output = '';
30+
$exitCode = null;
31+
\exec("php -l {$path}", $output, $exitCode);
32+
if (0 !== $exitCode) {
33+
$text = \implode("\n", $output);
34+
35+
throw new \Exception("Error in test server code: {$text}");
36+
}
3737
}
38+
3839
/**
3940
* Makes a directory in a temporary path containing only an `index.php` file with
4041
* the specified content ($code).
@@ -59,6 +60,7 @@ private function makeTemporaryServerDirectory($code)
5960
\fclose($handle);
6061

6162
$this->lint($indexPHP);
63+
6264
return $dir;
6365
}
6466

@@ -129,9 +131,6 @@ public function stopTestServer()
129131
foreach ($lines as $line) {
130132
if (self::isPHPTestServerRequestLogLine($line)) {
131133
++$n;
132-
} else {
133-
\flush();
134-
\ob_flush();
135134
}
136135
}
137136

0 commit comments

Comments
 (0)