-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from open-sausages/pulls/allow-empty-response
Suppress exception in case of empty curl response
- Loading branch information
Showing
4 changed files
with
83 additions
and
22 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Test\WebDriver; | ||
|
||
use WebDriver\Service\CurlServiceInterface; | ||
|
||
/** | ||
* HTTP 200 response for any request: | ||
* - /session returns invalid json | ||
* - any other request returns empty body | ||
*/ | ||
class TestCurlService implements CurlServiceInterface | ||
{ | ||
public function execute($requestMethod, $url, $parameters = null, $extraOptions = array()) | ||
{ | ||
$info = array( | ||
'url' => $url, | ||
'request_method' => $requestMethod, | ||
'http_code' => 200, | ||
); | ||
if (preg_match('#.*session$#', $url)) { | ||
$result = 'some invalid json'; | ||
} else { | ||
$result = ''; | ||
} | ||
return array($result, $info); | ||
} | ||
} |
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