OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
aws-ses
/
vendor
/
aws
/
aws-sdk-php
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/14/2024 10:51:40 AM
rwxr-xr-x
📄
AbstractConfigurationProviderTest.php
3.42 KB
08/14/2024 10:51:15 AM
rw-r--r--
📁
Api
-
08/14/2024 11:03:20 AM
rwxr-xr-x
📁
Arn
-
08/14/2024 10:55:43 AM
rwxr-xr-x
📁
Auth
-
08/14/2024 10:52:37 AM
rwxr-xr-x
📄
AwsClientTest.php
29.67 KB
08/14/2024 10:51:15 AM
rw-r--r--
📁
Build
-
08/14/2024 10:55:44 AM
rwxr-xr-x
📄
ClientResolverTest.php
55.74 KB
08/14/2024 10:51:15 AM
rw-r--r--
📁
ClientSideMonitoring
-
08/14/2024 10:52:37 AM
rwxr-xr-x
📁
CloudFront
-
08/14/2024 10:55:44 AM
rwxr-xr-x
📁
CloudSearchDomain
-
08/14/2024 10:52:38 AM
rwxr-xr-x
📁
CloudTrail
-
08/14/2024 10:52:38 AM
rwxr-xr-x
📁
CloudWatchLogs
-
08/14/2024 10:52:38 AM
rwxr-xr-x
📁
CognitoIdentity
-
08/14/2024 10:52:38 AM
rwxr-xr-x
📁
CognitoSync
-
08/14/2024 10:52:38 AM
rwxr-xr-x
📄
CommandPoolTest.php
5.8 KB
08/14/2024 10:51:15 AM
rw-r--r--
📄
CommandTest.php
3.28 KB
08/14/2024 10:51:15 AM
rw-r--r--
📄
ConfigurationResolverTest.php
12.35 KB
08/14/2024 10:51:15 AM
rw-r--r--
📁
Credentials
-
08/14/2024 11:03:11 AM
rwxr-xr-x
📁
Crypto
-
08/14/2024 10:55:44 AM
rwxr-xr-x
📁
DefaultsMode
-
08/14/2024 10:52:40 AM
rwxr-xr-x
📁
DocDb
-
08/14/2024 10:52:40 AM
rwxr-xr-x
📄
DoctrineCacheAdapterTest.php
1.23 KB
08/14/2024 10:51:15 AM
rw-r--r--
📁
DynamoDb
-
08/14/2024 10:52:40 AM
rwxr-xr-x
📁
Ec2
-
08/14/2024 10:52:41 AM
rwxr-xr-x
📁
ElasticLoadBalancingV2
-
08/14/2024 10:52:41 AM
rwxr-xr-x
📁
Endpoint
-
08/14/2024 10:55:45 AM
rwxr-xr-x
📁
EndpointDiscovery
-
08/14/2024 11:03:21 AM
rwxr-xr-x
📄
EndpointParameterMiddlewareTest.php
9.21 KB
08/14/2024 10:51:16 AM
rw-r--r--
📁
EndpointV2
-
08/14/2024 10:55:47 AM
rwxr-xr-x
📁
EventBridge
-
08/14/2024 10:52:42 AM
rwxr-xr-x
📁
Exception
-
08/14/2024 10:52:42 AM
rwxr-xr-x
📄
FunctionsTest.php
14.33 KB
08/14/2024 10:51:16 AM
rw-r--r--
📁
Glacier
-
08/14/2024 10:52:43 AM
rwxr-xr-x
📁
Handler
-
08/14/2024 10:55:48 AM
rwxr-xr-x
📄
HandlerListTest.php
7.16 KB
08/14/2024 10:51:16 AM
rw-r--r--
📄
HasMonitoringEventsTraitTest.php
895 bytes
08/14/2024 10:51:16 AM
rw-r--r--
📄
HashingStreamTest.php
1.41 KB
08/14/2024 10:51:16 AM
rw-r--r--
📄
HistoryTest.php
4.2 KB
08/14/2024 10:51:16 AM
rw-r--r--
📄
IdempotencyTokenMiddlewareTest.php
2.76 KB
08/14/2024 10:51:16 AM
rw-r--r--
📁
Identity
-
08/14/2024 10:55:48 AM
rwxr-xr-x
📄
InputValidationMiddlewareTest.php
5.62 KB
08/14/2024 10:51:16 AM
rw-r--r--
📁
Integ
-
08/14/2024 10:52:43 AM
rwxr-xr-x
📄
JsonCompilerTest.php
730 bytes
08/14/2024 10:51:16 AM
rw-r--r--
📁
Lambda
-
08/14/2024 10:52:43 AM
rwxr-xr-x
📁
LexModelsV2
-
08/14/2024 10:52:43 AM
rwxr-xr-x
📄
LruArrayCacheTest.php
1.59 KB
08/14/2024 10:51:16 AM
rw-r--r--
📁
MachineLearning
-
08/14/2024 10:52:44 AM
rwxr-xr-x
📄
MiddlewareTest.php
16.08 KB
08/14/2024 10:51:16 AM
rw-r--r--
📄
MockHandlerTest.php
3.79 KB
08/14/2024 10:51:16 AM
rw-r--r--
📄
MultiRegionClientTest.php
5.41 KB
08/14/2024 10:51:16 AM
rw-r--r--
📁
Multipart
-
08/14/2024 10:52:44 AM
rwxr-xr-x
📁
Neptune
-
08/14/2024 10:52:44 AM
rwxr-xr-x
📄
PerformanceContext.php
8.2 KB
08/14/2024 10:51:16 AM
rw-r--r--
📄
PhpHashTest.php
1.33 KB
08/14/2024 10:51:16 AM
rw-r--r--
📁
Polly
-
08/14/2024 10:52:44 AM
rwxr-xr-x
📄
PresignUrlMiddlewareTest.php
3.95 KB
08/14/2024 10:51:16 AM
rw-r--r--
📄
Psr16CacheAdapterTest.php
1.84 KB
08/14/2024 10:51:16 AM
rw-r--r--
📄
PsrCacheAdapterTest.php
2.64 KB
08/14/2024 10:51:16 AM
rw-r--r--
📄
QueryCompatibleInputMiddlewareTest.php
9.1 KB
08/14/2024 10:51:16 AM
rw-r--r--
📁
Rds
-
08/14/2024 10:52:44 AM
rwxr-xr-x
📁
RequestCompression
-
08/14/2024 10:55:48 AM
rwxr-xr-x
📄
ResultPaginatorTest.php
16.21 KB
08/14/2024 10:51:16 AM
rw-r--r--
📄
ResultTest.php
1.38 KB
08/14/2024 10:51:16 AM
rw-r--r--
📁
Retry
-
08/14/2024 10:52:45 AM
rwxr-xr-x
📄
RetryMiddlewareTest.php
24.57 KB
08/14/2024 10:51:16 AM
rw-r--r--
📄
RetryMiddlewareV2Test.php
40.33 KB
08/14/2024 10:51:17 AM
rw-r--r--
📁
Route53
-
08/14/2024 10:52:45 AM
rwxr-xr-x
📁
S3
-
08/14/2024 11:03:22 AM
rwxr-xr-x
📁
S3Control
-
08/14/2024 10:52:47 AM
rwxr-xr-x
📁
Script
-
08/14/2024 10:52:47 AM
rwxr-xr-x
📄
SdkTest.php
2.37 KB
08/14/2024 10:51:17 AM
rw-r--r--
📁
Ses
-
08/14/2024 10:52:47 AM
rwxr-xr-x
📁
Signature
-
08/14/2024 10:52:48 AM
rwxr-xr-x
📁
Sqs
-
08/14/2024 10:52:48 AM
rwxr-xr-x
📁
Ssm
-
08/14/2024 10:52:48 AM
rwxr-xr-x
📄
StreamRequestPayloadMiddlewareTest.php
10.1 KB
08/14/2024 10:51:17 AM
rw-r--r--
📁
Sts
-
08/14/2024 10:55:49 AM
rwxr-xr-x
📄
TestServiceTrait.php
3.78 KB
08/14/2024 10:51:17 AM
rw-r--r--
📁
Token
-
08/14/2024 10:52:49 AM
rwxr-xr-x
📄
TraceMiddlewareTest.php
16.16 KB
08/14/2024 10:51:17 AM
rw-r--r--
📄
UsesServiceTrait.php
4.37 KB
08/14/2024 10:51:17 AM
rw-r--r--
📄
WaiterTest.php
12.63 KB
08/14/2024 10:51:17 AM
rw-r--r--
📄
WrappedHttpHandlerTest.php
13.8 KB
08/14/2024 10:51:17 AM
rw-r--r--
📁
bootstrap
-
08/14/2024 10:52:37 AM
rwxr-xr-x
📄
bootstrap.php
1.53 KB
08/14/2024 10:51:15 AM
rw-r--r--
📁
fixtures
-
08/14/2024 11:03:22 AM
rwxr-xr-x
📁
static
-
08/14/2024 10:52:48 AM
rwxr-xr-x
Editing: MultiRegionClientTest.php
Close
<?php namespace Aws\Test; use Aws\Api\Service; use Aws\AwsClient; use Aws\Command; use Aws\CommandInterface; use Aws\Exception\AwsException; use Aws\HandlerList; use Aws\MockHandler; use Aws\MultiRegionClient; use Aws\Result; use GuzzleHttp\Promise\FulfilledPromise; use GuzzleHttp\Psr7\Response; use Psr\Http\Message\RequestInterface; use Yoast\PHPUnitPolyfills\TestCases\TestCase; class MultiRegionClientTest extends TestCase { /** @var MultiRegionClient */ private $instance; /** @var \PHPUnit_Framework_MockObject_MockObject */ private $mockRegionalClient; public function set_up() { $this->mockRegionalClient = $this->getMockBuilder(AwsClient::class) ->disableOriginalConstructor() ->getMock(); $this->mockRegionalClient->expects($this->any()) ->method('getApi') ->with() ->willReturn($this->getMockApi()); $this->instance = new MultiRegionClient([ 'service' => 'sns', 'region' => 'us-east-1', 'version' => 'latest', ]); $property = (new \ReflectionClass(MultiRegionClient::class)) ->getProperty('clientPool'); $property->setAccessible(true); $property->setValue($this->instance, [ '' => $this->mockRegionalClient, ]); } private function getMockApi() { $api = $this->getMockBuilder(Service::class) ->disableOriginalConstructor() ->getMock(); $api->expects($this->any()) ->method('getWaiterConfig') ->withAnyParameters() ->willReturn([]); return $api; } public function testGetRegionReturnsDefaultRegion() { $instance = new MultiRegionClient([ 'service' => 'route53', 'region' => 'us-east-1', 'version' => 'latest', ]); $this->assertSame('us-east-1', $instance->getRegion()); } public function testRegionCanBeOverriddenPerOperation() { $instance = new MultiRegionClient([ 'service' => 'sns', 'version' => 'latest', 'region' => 'us-east-1', 'http_handler' => function (RequestInterface $request) { $this->assertSame('sns.us-west-2.amazonaws.com', $request->getUri()->getHost()); return new FulfilledPromise(new Response(200, [], '<node></node>')); }, ]); $instance->publish([ 'Message' => 'Message for you, sir!', '@region' => 'us-west-2', ]); } public function testProxiesArbitraryCallsToRegionalizedClient() { $mockHandler = $this->getMockBuilder(HandlerList::class) ->disableOriginalConstructor() ->getMock(); $mockHandler->expects($this->atLeastOnce()) ->method('resolve') ->willReturn(function (CommandInterface $c) { return new FulfilledPromise(new Result); }); $this->mockRegionalClient->expects($this->once()) ->method('getCommand') ->with('baz', ['foo' => 'bar', '@http' => [], '@context' => []]) ->willReturn(new Command('Baz', [], $mockHandler)); $this->instance->baz(['foo' => 'bar']); } /** * @dataProvider clientInterfaceMethodProvider * * @param string $method * @param array $args */ public function testProxiesCallsToRegionalizedClient($method, array $args) { $expectation = $this->mockRegionalClient->expects($this->once()) ->method($method); call_user_func_array([$expectation, 'with'], $args); call_user_func_array([$this->instance, $method], $args); } public function clientInterfaceMethodProvider() { return [ ['getConfig', ['someOption']], ['getCredentials', []], ['getApi', []], ['getEndpoint', []], ]; } public function testDefaultsToAwsPartition() { $mrc = new MultiRegionClient([ 'service' => 'ec2', ]); $this->assertSame('aws', $mrc->getConfig('partition')->getName()); } public function testRejectsUnrecognizedPartitions() { $this->expectException(\InvalidArgumentException::class); new MultiRegionClient([ 'service' => 'ec2', 'partition' => 'foo', ]); } public function testUseCustomHandler() { $mockHandler = new MockHandler(); $mockHandler->append(new Result(["foo" => "bar"])); $mockHandler->append(function (CommandInterface $cmd, RequestInterface $req) { return new AwsException('Mock exception', $cmd); }); $s3 = new MultiRegionClient([ 'service' => 's3', 'version' => 'latest', 'region' => 'us-east-1' ]); $s3->useCustomHandler($mockHandler); $response = $s3->listBuckets(); $this->assertEquals('bar', $response['foo']); if (method_exists($this, 'expectException')) { $this->expectException(AwsException::class); $this->expectExceptionMessage('Mock exception'); } else { $this->setExpectedException(AwsException::class); } $s3->listBuckets(); } }