OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
zzaws-ses
/
vendor
/
aws
/
aws-sdk-php
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
10/04/2024 04:46:13 AM
rwxr-xr-x
📄
AbstractConfigurationProviderTest.php
3.42 KB
08/14/2024 07:57:51 AM
rw-r--r--
📁
Api
-
08/14/2024 08:08:06 AM
rwxr-xr-x
📁
Arn
-
08/14/2024 08:01:03 AM
rwxr-xr-x
📁
Auth
-
08/14/2024 07:59:04 AM
rwxr-xr-x
📄
AwsClientTest.php
29.67 KB
08/14/2024 07:57:51 AM
rw-r--r--
📁
Build
-
08/14/2024 08:01:04 AM
rwxr-xr-x
📄
ClientResolverTest.php
55.74 KB
08/14/2024 07:57:51 AM
rw-r--r--
📁
ClientSideMonitoring
-
08/14/2024 07:59:04 AM
rwxr-xr-x
📁
CloudFront
-
08/14/2024 08:01:04 AM
rwxr-xr-x
📁
CloudSearchDomain
-
08/14/2024 07:59:05 AM
rwxr-xr-x
📁
CloudTrail
-
08/14/2024 07:59:05 AM
rwxr-xr-x
📁
CloudWatchLogs
-
08/14/2024 07:59:05 AM
rwxr-xr-x
📁
CognitoIdentity
-
08/14/2024 07:59:05 AM
rwxr-xr-x
📁
CognitoSync
-
08/14/2024 07:59:05 AM
rwxr-xr-x
📄
CommandPoolTest.php
5.8 KB
08/14/2024 07:57:51 AM
rw-r--r--
📄
CommandTest.php
3.28 KB
08/14/2024 07:57:51 AM
rw-r--r--
📄
ConfigurationResolverTest.php
12.35 KB
08/14/2024 07:57:52 AM
rw-r--r--
📁
Credentials
-
08/14/2024 08:07:59 AM
rwxr-xr-x
📁
Crypto
-
08/14/2024 08:01:04 AM
rwxr-xr-x
📁
DefaultsMode
-
08/14/2024 07:59:06 AM
rwxr-xr-x
📁
DocDb
-
08/14/2024 07:59:06 AM
rwxr-xr-x
📄
DoctrineCacheAdapterTest.php
1.23 KB
08/14/2024 07:57:52 AM
rw-r--r--
📁
DynamoDb
-
08/14/2024 07:59:07 AM
rwxr-xr-x
📁
Ec2
-
08/14/2024 07:59:07 AM
rwxr-xr-x
📁
ElasticLoadBalancingV2
-
08/14/2024 07:59:07 AM
rwxr-xr-x
📁
Endpoint
-
08/14/2024 08:01:05 AM
rwxr-xr-x
📁
EndpointDiscovery
-
08/14/2024 08:08:07 AM
rwxr-xr-x
📄
EndpointParameterMiddlewareTest.php
9.21 KB
08/14/2024 07:57:52 AM
rw-r--r--
📁
EndpointV2
-
08/14/2024 08:01:06 AM
rwxr-xr-x
📁
EventBridge
-
08/14/2024 07:59:08 AM
rwxr-xr-x
📁
Exception
-
08/14/2024 07:59:08 AM
rwxr-xr-x
📄
FunctionsTest.php
14.33 KB
08/14/2024 07:57:52 AM
rw-r--r--
📁
Glacier
-
08/14/2024 07:59:09 AM
rwxr-xr-x
📁
Handler
-
08/14/2024 08:01:06 AM
rwxr-xr-x
📄
HandlerListTest.php
7.16 KB
08/14/2024 07:57:52 AM
rw-r--r--
📄
HasMonitoringEventsTraitTest.php
895 bytes
08/14/2024 07:57:52 AM
rw-r--r--
📄
HashingStreamTest.php
1.41 KB
08/14/2024 07:57:52 AM
rw-r--r--
📄
HistoryTest.php
4.2 KB
08/14/2024 07:57:52 AM
rw-r--r--
📄
IdempotencyTokenMiddlewareTest.php
2.76 KB
08/14/2024 07:57:52 AM
rw-r--r--
📁
Identity
-
08/14/2024 08:01:07 AM
rwxr-xr-x
📄
InputValidationMiddlewareTest.php
5.62 KB
08/14/2024 07:57:52 AM
rw-r--r--
📁
Integ
-
08/14/2024 07:59:09 AM
rwxr-xr-x
📄
JsonCompilerTest.php
730 bytes
08/14/2024 07:57:52 AM
rw-r--r--
📁
Lambda
-
08/14/2024 07:59:09 AM
rwxr-xr-x
📁
LexModelsV2
-
08/14/2024 07:59:09 AM
rwxr-xr-x
📄
LruArrayCacheTest.php
1.59 KB
08/14/2024 07:57:52 AM
rw-r--r--
📁
MachineLearning
-
08/14/2024 07:59:10 AM
rwxr-xr-x
📄
MiddlewareTest.php
16.08 KB
08/14/2024 07:57:52 AM
rw-r--r--
📄
MockHandlerTest.php
3.79 KB
08/14/2024 07:57:52 AM
rw-r--r--
📄
MultiRegionClientTest.php
5.41 KB
08/14/2024 07:57:52 AM
rw-r--r--
📁
Multipart
-
08/14/2024 07:59:10 AM
rwxr-xr-x
📁
Neptune
-
08/14/2024 07:59:10 AM
rwxr-xr-x
📄
PerformanceContext.php
8.2 KB
08/14/2024 07:57:52 AM
rw-r--r--
📄
PhpHashTest.php
1.33 KB
08/14/2024 07:57:52 AM
rw-r--r--
📁
Polly
-
08/14/2024 07:59:10 AM
rwxr-xr-x
📄
PresignUrlMiddlewareTest.php
3.95 KB
08/14/2024 07:57:52 AM
rw-r--r--
📄
Psr16CacheAdapterTest.php
1.84 KB
08/14/2024 07:57:52 AM
rw-r--r--
📄
PsrCacheAdapterTest.php
2.64 KB
08/14/2024 07:57:52 AM
rw-r--r--
📄
QueryCompatibleInputMiddlewareTest.php
9.1 KB
08/14/2024 07:57:52 AM
rw-r--r--
📁
Rds
-
08/14/2024 07:59:10 AM
rwxr-xr-x
📁
RequestCompression
-
08/14/2024 08:01:07 AM
rwxr-xr-x
📄
ResultPaginatorTest.php
16.21 KB
08/14/2024 07:57:52 AM
rw-r--r--
📄
ResultTest.php
1.38 KB
08/14/2024 07:57:53 AM
rw-r--r--
📁
Retry
-
08/14/2024 07:59:11 AM
rwxr-xr-x
📄
RetryMiddlewareTest.php
24.57 KB
08/14/2024 07:57:53 AM
rw-r--r--
📄
RetryMiddlewareV2Test.php
40.33 KB
08/14/2024 07:57:53 AM
rw-r--r--
📁
Route53
-
08/14/2024 07:59:11 AM
rwxr-xr-x
📁
S3
-
08/14/2024 08:08:07 AM
rwxr-xr-x
📁
S3Control
-
08/14/2024 07:59:12 AM
rwxr-xr-x
📁
Script
-
08/14/2024 07:59:12 AM
rwxr-xr-x
📄
SdkTest.php
2.37 KB
08/14/2024 07:57:53 AM
rw-r--r--
📁
Ses
-
08/14/2024 07:59:12 AM
rwxr-xr-x
📁
Signature
-
08/14/2024 07:59:13 AM
rwxr-xr-x
📁
Sqs
-
08/14/2024 07:59:13 AM
rwxr-xr-x
📁
Ssm
-
08/14/2024 07:59:13 AM
rwxr-xr-x
📄
StreamRequestPayloadMiddlewareTest.php
10.1 KB
08/14/2024 07:57:53 AM
rw-r--r--
📁
Sts
-
08/14/2024 08:01:08 AM
rwxr-xr-x
📄
TestServiceTrait.php
3.78 KB
08/14/2024 07:57:53 AM
rw-r--r--
📁
Token
-
08/14/2024 07:59:13 AM
rwxr-xr-x
📄
TraceMiddlewareTest.php
16.16 KB
08/14/2024 07:57:53 AM
rw-r--r--
📄
UsesServiceTrait.php
4.37 KB
08/14/2024 07:57:53 AM
rw-r--r--
📄
WaiterTest.php
12.63 KB
08/14/2024 07:57:53 AM
rw-r--r--
📄
WrappedHttpHandlerTest.php
13.8 KB
08/14/2024 07:57:53 AM
rw-r--r--
📁
bootstrap
-
08/14/2024 07:59:04 AM
rwxr-xr-x
📄
bootstrap.php
1.53 KB
08/14/2024 07:57:51 AM
rw-r--r--
📁
fixtures
-
08/14/2024 08:08:07 AM
rwxr-xr-x
📁
static
-
08/14/2024 07:59:13 AM
rwxr-xr-x
Editing: StreamRequestPayloadMiddlewareTest.php
Close
<?php namespace Aws\Test; use Aws\Api\Service; use Aws\AwsClient; use Aws\ClientResolver; use Aws\CommandInterface; use Aws\HandlerList; use Aws\Middleware; use Aws\Result; use Aws\StreamRequestPayloadMiddleware; use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts; use GuzzleHttp\Psr7; use GuzzleHttp\Psr7\Request; use Yoast\PHPUnitPolyfills\TestCases\TestCase; use Psr\Http\Message\RequestInterface; /** * @covers \Aws\StreamRequestPayloadMiddleware */ class StreamRequestPayloadMiddlewareTest extends TestCase { use ArraySubsetAsserts; /** * @dataProvider generateTestCases * * @param CommandInterface $command * @param array $expectedHeaders * @param array $expectedNonHeaders */ public function testAddsProperHeaders( CommandInterface $command, array $expectedHeaders, array $expectedNonHeaders ) { $list = $this->generateTestHandlerList(); $list->setHandler(function ( CommandInterface $command, RequestInterface $request ) use ( $expectedHeaders, $expectedNonHeaders ) { $this->assertArraySubset($expectedHeaders, $request->getHeaders()); foreach ($expectedNonHeaders as $header) { $this->assertArrayNotHasKey($header, $request->getHeaders()); } return new Result([]); }); $handler = $list->resolve(); $handler($command, new Request('POST', 'https://foo.com')); } public function generateTestCases() { $service = $this->generateTestService(); $client = $this->generateTestClient($service); $inputStream = Psr7\Utils::streamFor('test'); return [ [ $client->getCommand( 'NonStreamingOp', [ 'InputString' => 'teststring', ] ), [], [ 'transfer-encoding', 'content-length'], ], [ $client->getCommand( 'StreamingOp', [ 'InputStream' => $inputStream, ] ), [ 'content-length' => [26] ], [ 'transfer-encoding' ], ], [ $client->getCommand( 'StreamingLengthOp', [ 'InputStream' => $inputStream, ] ), [ 'content-length' => [26] ], [ 'transfer-encoding' ], ], [ $client->getCommand( 'StreamingUnsignedOp', [ 'InputStream' => $inputStream, ] ), [ 'transfer-encoding' => ['chunked'] ], [ 'content-length' ], ], [ $client->getCommand( 'StreamingLengthUnsignedOp', [ 'InputStream' => $inputStream, ] ), [ 'content-length' => [26] ], [ 'transfer-encoding' ], ], ]; } public function testThrowsExceptionOnIncalculableSize() { $this->expectExceptionMessage("Payload content length is required and can not be calculated."); $this->expectException(\Aws\Exception\IncalculablePayloadException::class); $service = $this->generateTestService(); $client = $this->generateTestClient($service); $command = $client->getCommand( 'StreamingOp', [ 'InputStream' => Psr7\Utils::streamFor('test'), ] ); $middleware = StreamRequestPayloadMiddleware::wrap($service); $invokable = $middleware(function($cmd, $req) {}); // Mock a request with a body whose size returns null $filestream = tmpfile(); $streamMock = $this->getMockBuilder(Psr7\Stream::class) ->setConstructorArgs([$filestream]) ->getMock(); $streamMock->expects($this->any()) ->method('getSize') ->willReturn(null); $requestMock = $this->getMockBuilder(Request::class) ->setConstructorArgs(['POST', 'https://foo.com']) ->setMethods(['getBody']) ->getMock(); $requestMock->expects($this->any()) ->method('getBody') ->willReturn($streamMock); $invokable($command, $requestMock); fclose($filestream); } private function generateTestHandlerList() { $service = $this->generateTestService(); $serializer = ClientResolver::_default_serializer([ 'api' => $service, 'endpoint' => '' ]); $list = new HandlerList(); $list->prependBuild(Middleware::requestBuilder($serializer), 'builder'); $list->prependSign( StreamRequestPayloadMiddleware::wrap($service), 'StreamRequestPayloadMiddleware' ); return $list; } private function generateTestClient(Service $service, $args = []) { return new AwsClient( array_merge( [ 'service' => 'foo', 'api_provider' => function () use ($service) { return $service->toArray(); }, 'region' => 'us-east-1', 'version' => 'latest', ], $args ) ); } private function generateTestService() { return new Service( [ 'metadata' => [ "protocol" => "rest-json", "apiVersion" => "2014-01-01" ], 'shapes' => [ "BlobLengthStream" => [ "type" => "blob", "streaming" => true, "requiresLength" => true, ], "BlobStream" => [ "type" => "blob", "streaming" => true, ], "NonStreamingInputShape" => [ "type" => "structure", "required" => [ "InputString", ], "members" => [ "InputString" => [ "shape" => "StringType", ], ], ], "StreamingInputShape" => [ "type" => "structure", "required" => [ "InputStream", ], "members" => [ "InputStream" => [ "shape" => "BlobStream", ], "InputString" => [ "shape" => "StringType", ], ], ], "StreamingLengthInputShape" => [ "type" => "structure", "members" => [ "InputStream" => [ "shape" => "BlobLengthStream", ], ], ], "StringType"=> [ "type" => "string", ], ], 'operations' => [ "NonStreamingOp" => [ "name"=> "NonStreamingOp", "http"=> [ "method"=> "POST", "requestUri"=> "/", "responseCode"=> 200 ], "input"=> ["shape"=> "NonStreamingInputShape"], ], "StreamingOp" => [ "name"=> "StreamingOp", "http"=> [ "method"=> "POST", "requestUri"=> "/", "responseCode"=> 200 ], "input"=> ["shape"=> "StreamingInputShape"], ], "StreamingLengthOp" => [ "name"=> "StreamingLengthOp", "http"=> [ "method"=> "POST", "requestUri"=> "/", "responseCode"=> 200 ], "input"=> ["shape"=> "StreamingLengthInputShape"], ], "StreamingUnsignedOp" => [ "name"=> "StreamingUnsignedOp", "http"=> [ "method"=> "POST", "requestUri"=> "/", "responseCode"=> 200 ], "input"=> ["shape"=> "StreamingInputShape"], "authtype" => "v4-unsigned-body", ], "StreamingLengthUnsignedOp" => [ "name"=> "StreamingLengthUnsignedOp", "http"=> [ "method"=> "POST", "requestUri"=> "/", "responseCode"=> 200 ], "input"=> ["shape"=> "StreamingLengthInputShape"], "authtype" => "v4-unsigned-body", ], ], ], function () { return []; } ); } }