Skip to content

Commit 009f457

Browse files
committed
Fix googleapis#424: Account for installs without the cURL extension enabled.
1 parent 4241f3d commit 009f457

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/Google/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function __construct($ini_file_location = null)
126126
)
127127
),
128128
'Google_IO_Exception' => array(
129-
'retry_map' => array(
129+
'retry_map' => !extension_loaded('curl') ? array() : array(
130130
CURLE_COULDNT_RESOLVE_HOST => self::TASK_RETRY_ALWAYS,
131131
CURLE_COULDNT_CONNECT => self::TASK_RETRY_ALWAYS,
132132
CURLE_OPERATION_TIMEOUTED => self::TASK_RETRY_ALWAYS,

tests/general/TaskTest.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ public function testRestTimeouts($config, $minTime)
151151
}
152152

153153
/**
154+
* @requires extension curl
154155
* @dataProvider defaultCurlErrorProvider
155156
* @expectedException Google_IO_Exception
156157
*/
@@ -160,6 +161,7 @@ public function testCurlRetryOffByDefault($errorCode, $errorMessage = '')
160161
}
161162

162163
/**
164+
* @requires extension curl
163165
* @dataProvider defaultCurlErrorProvider
164166
* @expectedException Google_IO_Exception
165167
*/
@@ -170,6 +172,7 @@ public function testOneCurlRetryWithError($errorCode, $errorMessage = '')
170172
}
171173

172174
/**
175+
* @requires extension curl
173176
* @dataProvider defaultCurlErrorProvider
174177
* @expectedException Google_IO_Exception
175178
*/
@@ -182,6 +185,7 @@ public function testMultipleCurlRetriesWithErrors(
182185
}
183186

184187
/**
188+
* @requires extension curl
185189
* @dataProvider defaultCurlErrorProvider
186190
*/
187191
public function testOneCurlRetryWithSuccess($errorCode, $errorMessage = '')
@@ -195,6 +199,7 @@ public function testOneCurlRetryWithSuccess($errorCode, $errorMessage = '')
195199
}
196200

197201
/**
202+
* @requires extension curl
198203
* @dataProvider defaultCurlErrorProvider
199204
*/
200205
public function testMultipleCurlRetriesWithSuccess(
@@ -210,6 +215,7 @@ public function testMultipleCurlRetriesWithSuccess(
210215
}
211216

212217
/**
218+
* @requires extension curl
213219
* @dataProvider defaultCurlErrorProvider
214220
* @expectedException Google_IO_Exception
215221
*/
@@ -226,6 +232,9 @@ public function testCustomCurlRetryMapReplacesDefaults(
226232
$this->setNextResponseThrows($errorMessage, $errorCode)->makeRequest();
227233
}
228234

235+
/**
236+
* @requires extension curl
237+
*/
229238
public function testCustomCurlRetryMapAddsNewHandlers()
230239
{
231240
$this->client->setClassConfig(
@@ -244,6 +253,7 @@ public function testCustomCurlRetryMapAddsNewHandlers()
244253
}
245254

246255
/**
256+
* @requires extension curl
247257
* @expectedException Google_IO_Exception
248258
* @dataProvider customLimitsProvider
249259
*/
@@ -262,6 +272,7 @@ public function testCustomCurlRetryMapWithCustomLimits($limit)
262272
}
263273

264274
/**
275+
* @requires extension curl
265276
* @dataProvider timeoutProvider
266277
*/
267278
public function testCurlTimeouts($config, $minTime)
@@ -471,11 +482,11 @@ public function defaultRestErrorProvider()
471482
public function defaultCurlErrorProvider()
472483
{
473484
return array(
474-
array(CURLE_COULDNT_RESOLVE_HOST),
475-
array(CURLE_COULDNT_CONNECT),
476-
array(CURLE_OPERATION_TIMEOUTED),
477-
array(CURLE_SSL_CONNECT_ERROR),
478-
array(CURLE_GOT_NOTHING),
485+
array(6), // CURLE_COULDNT_RESOLVE_HOST
486+
array(7), // CURLE_COULDNT_CONNECT
487+
array(28), // CURLE_OPERATION_TIMEOUTED
488+
array(35), // CURLE_SSL_CONNECT_ERROR
489+
array(52), // CURLE_GOT_NOTHING
479490
);
480491
}
481492

0 commit comments

Comments
 (0)