OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
znew1aws-ses
/
vendor
/
aws
/
aws-sdk-php
/
tests
/
Integ
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/16/2024 08:32:34 AM
rwxr-xr-x
📄
BatchingContext.php
6.76 KB
08/16/2024 08:30:05 AM
rw-r--r--
📄
BlockingContext.php
4.77 KB
08/16/2024 08:30:05 AM
rw-r--r--
📄
ConcurrencyContext.php
4.73 KB
08/16/2024 08:30:05 AM
rw-r--r--
📄
CredentialsContext.php
4.07 KB
08/16/2024 08:30:05 AM
rw-r--r--
📄
CrtContext.php
8.28 KB
08/16/2024 08:30:05 AM
rw-r--r--
📄
GuzzleV5HandlerTest.php
2.62 KB
08/16/2024 08:30:05 AM
rw-r--r--
📄
GuzzleV6StreamHandlerTest.php
2.44 KB
08/16/2024 08:30:06 AM
rw-r--r--
📄
IntegUtils.php
1.53 KB
08/16/2024 08:30:06 AM
rw-r--r--
📄
MultipartContext.php
7.36 KB
08/16/2024 08:30:06 AM
rw-r--r--
📄
NativeStreamContext.php
4.65 KB
08/16/2024 08:30:06 AM
rw-r--r--
📄
S3Context.php
11.13 KB
08/16/2024 08:30:06 AM
rw-r--r--
📄
S3EncryptionContext.php
7.44 KB
08/16/2024 08:30:06 AM
rw-r--r--
📄
S3EncryptionContextV2.php
7.79 KB
08/16/2024 08:30:06 AM
rw-r--r--
📄
SmokeContext.php
12.25 KB
08/16/2024 08:30:06 AM
rw-r--r--
Editing: GuzzleV5HandlerTest.php
Close
<?php namespace Aws\Test\Integ; use Aws\Handler\GuzzleV5\GuzzleHandler; use GuzzleHttp\Promise\RejectionException; use GuzzleHttp\Psr7; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Response; use Yoast\PHPUnitPolyfills\TestCases\TestCase; class GuzzleV5HandlerTest extends TestCase { public function set_up() { if (!class_exists('GuzzleHttp\Ring\Core')) { $this->markTestSkipped(); } } public function testSendRequest() { $handler = new GuzzleHandler(); $request = new Request( 'PUT', "http://httpbin.org/put?a=1&b=2", ['c' => '3', 'd' => '4'], Psr7\Utils::streamFor('{"f":6,"g":7}') ); $sink = Psr7\Utils::streamFor(); /** @var \GuzzleHttp\Promise\Promise $responsePromise */ $responsePromise = $handler($request, ['sink' => $sink, 'foo' => 'bar']); $responsePromise = $responsePromise->then( function (Response $resp) { return $resp->withHeader('e', '5'); }, function (array $error) { $this->fail('The request failed.'); } ); /** @var Response $response */ $response = $responsePromise->wait(); $body = $response->getBody()->getContents(); $data = json_decode($body, true); // Check response data. $this->assertArrayHasKey('C', $data['headers']); $this->assertArrayHasKey('D', $data['headers']); $this->assertArrayHasKey('a', $data['args']); $this->assertArrayHasKey('b', $data['args']); $this->assertArrayHasKey('f', $data['json']); $this->assertArrayHasKey('g', $data['json']); // Check response data. $this->assertTrue($response->hasHeader('E')); // Check the sink. $sink->seek(0); $this->assertSame($body, $sink->getContents()); } public function testProduceErrorData() { $handler = new GuzzleHandler(); $request = new Request('GET', 'http://httpbin.org/delay/3'); try { $handler($request, ['timeout' => 1])->wait(); } catch (RejectionException $e) { $error = $e->getReason(); $this->assertInstanceOf( 'GuzzleHttp\Exception\ConnectException', $error['exception'] ); $this->assertTrue($error['connection_error']); $this->assertArrayHasKey('response', $error); return; } $this->fail('A RejectionException should have been thrown.'); } }