@@ -121,6 +121,7 @@ protected function createClient( array $options = [] ): Client {
121121 * @dataProvider errorProvider
122122 */
123123 public function test_errors ( $ scenario , $ expectedErrorSubstring ) {
124+
124125 $ this ->withServer ( function ( $ url ) use ( $ scenario , $ expectedErrorSubstring ) {
125126 if (!is_array ($ expectedErrorSubstring )) {
126127 $ expectedErrorSubstring = [$ expectedErrorSubstring ];
@@ -144,16 +145,21 @@ public function test_errors( $scenario, $expectedErrorSubstring ) {
144145 }
145146
146147 public function errorProvider () {
147- return [
148+ $ cases = [
148149 'Broken Connection ' => [ 'broken-connection ' , ['Connection closed while reading response headers. ' , 'Request timed out ' ] ],
149150 'Invalid Response ' => [ 'invalid-response ' , 'Malformed HTTP headers received from the server. ' ],
150151 'Unsupported Encoding ' => [ 'unsupported-encoding ' , 'Unsupported transfer encoding received from the server: unsupported ' ],
151152 'Incomplete Status Line ' => [ 'incomplete-status-line ' , 'Malformed HTTP headers received from the server. ' ],
152153 'Early EOF Headers ' => [ 'early-eof-headers ' , ['Connection closed while reading response headers. ' , 'Request timed out ' ]],
153- 'Timeout ' => [ 'timeout ' , 'Request timed out ' ], // Client-side timeout
154- // @TODO: Fix this test. It's flaky between OSes and PHP versions.
155- // 'Timeout Read Body' => [ 'timeout-read-body', 'Request timed out' ], // Timeout during body read
156154 ];
155+
156+ // @TODO: Support these tests on PHP < 8.0
157+ if (PHP_VERSION_ID >= 80000 ) {
158+ $ cases ['Timeout ' ] = [ 'timeout ' , 'Request timed out ' ]; // Client-side timeout
159+ // @TODO: Fix this test. It's flaky between OSes and PHP versions.
160+ // $cases['Timeout Read Body'] = [ 'timeout-read-body', 'Request timed out' ]; // Timeout during body read
161+ }
162+ return $ cases ;
157163 }
158164
159165 protected function getClientSpecificErrorMessages (): array {
0 commit comments