Skip to content

Commit

Permalink
Fixed an issue with the Guzzle 5 handler and got the integ tests runn…
Browse files Browse the repository at this point in the history
…ing correctly.
  • Loading branch information
jeremeamia committed Jun 26, 2015
1 parent 58b830a commit 74876b5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Handler/GuzzleV5/GuzzleHandler.php
Expand Up @@ -91,8 +91,8 @@ private function createGuzzleRequest(Psr7Request $psrRequest, array $options)

// Remove unsupported options.
foreach (array_keys($options) as $key) {
if (isset(self::$validOptions[$key])) {
unset($options['key']);
if (!isset(self::$validOptions[$key])) {
unset($options[$key]);
}
}

Expand Down
5 changes: 2 additions & 3 deletions tests/Integ/GuzzleV5HandlerTest.php
Expand Up @@ -22,13 +22,13 @@ public function testSendRequest()
$request = new Request(
'PUT',
"http://httpbin.org/put?a=1&b=2",
['c' => '3', 'd' => '4', 'user-agent' => 'AWS/3'],
['c' => '3', 'd' => '4'],
Psr7\stream_for('{"f":6,"g":7}')
);
$sink = Psr7\stream_for();

/** @var \GuzzleHttp\Promise\Promise $responsePromise */
$responsePromise = $handler($request, ['sink' => $sink]);
$responsePromise = $handler($request, ['sink' => $sink, 'foo' => 'bar']);
$responsePromise = $responsePromise->then(
function (Response $resp) {
return $resp->withHeader('e', '5');
Expand All @@ -46,7 +46,6 @@ function (array $error) {
// Check response data.
$this->assertArrayHasKey('C', $data['headers']);
$this->assertArrayHasKey('D', $data['headers']);
$this->assertStringStartsWith('AWS/3 Guzzle/5', $data['headers']['User-Agent']);
$this->assertArrayHasKey('a', $data['args']);
$this->assertArrayHasKey('b', $data['args']);
$this->assertArrayHasKey('f', $data['json']);
Expand Down
7 changes: 7 additions & 0 deletions tests/Integ/UseStreamTest.php
Expand Up @@ -7,6 +7,13 @@ class UseStreamTest extends \PHPUnit_Framework_TestCase
{
use IntegUtils;

public function setUp()
{
if (!class_exists('GuzzleHttp\Handler\StreamHandler')) {
$this->markTestSkipped();
}
}

public function testCanUseStreamForBasicRequests()
{
$handler = new StreamHandler();
Expand Down

0 comments on commit 74876b5

Please sign in to comment.