-
-
Save marzocchi/53765347516f2b5e6c62657d29aa4be4 to your computer and use it in GitHub Desktop.
customizing Curl Options for WebDriver client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add the following to your testing bootstrap to override the default service class | |
WebDriver\ServiceFactory::getInstance()->setServiceClass('service.curl', '\\Tests\\WebDriverCurlService'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Tests; | |
use WebDriver\Service\CurlService; | |
use WebDriver\Service\CurlServiceInterface; | |
/** | |
* Class WebDriverCurlService | |
* @package Tests | |
* @author mark | |
*/ | |
class WebDriverCurlService extends CurlService implements CurlServiceInterface | |
{ | |
/** | |
* @param string $requestMethod | |
* @param string $url | |
* @param array|null $parameters | |
* @param array $extraOptions | |
* @return array | |
* @throws \Exception | |
*/ | |
public function execute($requestMethod, $url, $parameters = null, $extraOptions = array()) | |
{ | |
$extraOptions += [ | |
CURLOPT_CONNECTTIMEOUT => 60, | |
CURLOPT_TIMEOUT => 120 | |
]; | |
return parent::execute($requestMethod, $url, $parameters, $extraOptions); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment