Skip to content

Commit

Permalink
fix cURL timeout disabling when debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
tiger-seo committed Oct 24, 2013
1 parent a8b40e3 commit 284b914
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ php:

env:
- CODECEPTION_VERSION="1.6.*"
- CODECEPTION_VERSION="1.7.*"
- CODECEPTION_VERSION="dev-master"

before_script:
Expand Down
30 changes: 27 additions & 3 deletions src/Codeception/Extension/RemoteDebug.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

namespace Codeception\Extension;

use Codeception\Platform\Extension;
use Codeception\SuiteManager;
use Codeception\Module\PhpBrowser;
use Codeception\Platform\Extension;
use Codeception\Util\RemoteInterface;

class RemoteDebug extends Extension
Expand All @@ -24,9 +25,31 @@ protected function getRemoteConnectionModule()
return $module;
}
}

return null;
}

/**
* @return \Guzzle\Http\Client
*/
protected function getGuzzleHttpClient()
{
$client = null;
if (method_exists($this->module, 'getClient')) {
$client = $this->module->getClient();
} elseif ($this->module instanceof PhpBrowser) {
$driver = $this->module->session->getDriver();
if ($driver instanceof \Behat\Mink\Driver\GoutteDriver) {
$client = $driver->getClient();
if (method_exists($client, 'getClient')) {
$client = $client->getClient();
}
}
}

return ($client instanceof \Guzzle\Http\Client ? $client : null);
}

public function beforeSuite()
{
$this->module = $this->getRemoteConnectionModule();
Expand All @@ -40,8 +63,9 @@ public function beforeSuite()
) {
$this->module->setCookie('XDEBUG_SESSION', $this->config['sessionName']);

if (method_exists($this->module, 'getClient')) {
$clientConfig = $this->module->getClient()->getConfig();
$client = $this->getGuzzleHttpClient();
if ($client !== null) {
$clientConfig = $client->getConfig();
$curlOptions = $clientConfig->get('curl.options');
$curlOptions[CURLOPT_TIMEOUT] = 0;
$clientConfig->set('curl.options', $curlOptions);
Expand Down

0 comments on commit 284b914

Please sign in to comment.