OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
zzXpress
/
vendor
/
aws
/
aws-sdk-php
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📄
AbstractConfigurationProviderTest.php
3.42 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
Api
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
Arn
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
Auth
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📄
AwsClientTest.php
29.67 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
Build
-
11/13/2024 02:24:22 PM
rwxr-xr-x
📄
ClientResolverTest.php
55.74 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
ClientSideMonitoring
-
05/19/2025 10:07:23 AM
rwxr-xr-x
📁
CloudFront
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
CloudSearchDomain
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
CloudTrail
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
CloudWatchLogs
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
CognitoIdentity
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
CognitoSync
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📄
CommandPoolTest.php
5.8 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
CommandTest.php
3.28 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
ConfigurationResolverTest.php
12.35 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
Credentials
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
Crypto
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
DefaultsMode
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
DocDb
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📄
DoctrineCacheAdapterTest.php
1.23 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
DynamoDb
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
Ec2
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
ElasticLoadBalancingV2
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
Endpoint
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
EndpointDiscovery
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📄
EndpointParameterMiddlewareTest.php
9.21 KB
05/19/2025 10:07:23 AM
rw-r--r--
📁
EndpointV2
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
EventBridge
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
Exception
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📄
FunctionsTest.php
14.33 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
Glacier
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
Handler
-
11/13/2024 02:24:45 PM
rwxr-xr-x
📄
HandlerListTest.php
7.16 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
HasMonitoringEventsTraitTest.php
895 bytes
05/19/2025 10:07:24 AM
rw-r--r--
📄
HashingStreamTest.php
1.41 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
HistoryTest.php
4.2 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
IdempotencyTokenMiddlewareTest.php
2.76 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
Identity
-
11/13/2024 02:24:46 PM
rwxr-xr-x
📄
InputValidationMiddlewareTest.php
5.62 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
Integ
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📄
JsonCompilerTest.php
730 bytes
05/19/2025 10:07:23 AM
rw-r--r--
📁
Lambda
-
05/19/2025 10:07:23 AM
rwxr-xr-x
📁
LexModelsV2
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📄
LruArrayCacheTest.php
1.59 KB
05/19/2025 10:07:23 AM
rw-r--r--
📁
MachineLearning
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📄
MiddlewareTest.php
16.08 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
MockHandlerTest.php
3.79 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
MultiRegionClientTest.php
5.41 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
Multipart
-
05/19/2025 10:07:23 AM
rwxr-xr-x
📁
Neptune
-
05/19/2025 10:07:23 AM
rwxr-xr-x
📄
PerformanceContext.php
8.2 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
PhpHashTest.php
1.33 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
Polly
-
05/19/2025 10:07:23 AM
rwxr-xr-x
📄
PresignUrlMiddlewareTest.php
3.95 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
Psr16CacheAdapterTest.php
1.84 KB
05/19/2025 10:07:23 AM
rw-r--r--
📄
PsrCacheAdapterTest.php
2.64 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
QueryCompatibleInputMiddlewareTest.php
9.1 KB
05/19/2025 10:07:23 AM
rw-r--r--
📁
Rds
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
RequestCompression
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📄
ResultPaginatorTest.php
16.21 KB
05/19/2025 10:07:23 AM
rw-r--r--
📄
ResultTest.php
1.38 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
Retry
-
05/19/2025 10:07:23 AM
rwxr-xr-x
📄
RetryMiddlewareTest.php
24.57 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
RetryMiddlewareV2Test.php
40.33 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
Route53
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
S3
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
S3Control
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
Script
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📄
SdkTest.php
2.37 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
Ses
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
Signature
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
Sqs
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📁
Ssm
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📄
StreamRequestPayloadMiddlewareTest.php
10.1 KB
05/19/2025 10:07:23 AM
rw-r--r--
📁
Sts
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📄
TestServiceTrait.php
3.78 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
Token
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📄
TraceMiddlewareTest.php
16.16 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
UsesServiceTrait.php
4.37 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
WaiterTest.php
12.63 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
WrappedHttpHandlerTest.php
13.8 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
bootstrap
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📄
bootstrap.php
1.53 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
fixtures
-
11/13/2024 03:03:50 PM
rwxr-xr-x
📁
static
-
11/13/2024 02:07:43 PM
rwxr-xr-x
Editing: ResultPaginatorTest.php
Close
<?php namespace Aws\Test; use Aws\Api\ApiProvider; use Aws\CloudWatchLogs\CloudWatchLogsClient; use Aws\CommandInterface; use Aws\DynamoDb\DynamoDbClient; use Aws\Result; use GuzzleHttp\Promise; use Psr\Http\Message\RequestInterface; use Yoast\PHPUnitPolyfills\TestCases\TestCase; /** * @covers Aws\ResultPaginator */ class ResultPaginatorTest extends TestCase { use UsesServiceTrait; private function getCustomClientProvider(array $config) { // Create the client and paginator $provider = ApiProvider::defaultProvider(); return new DynamoDbClient([ 'region' => 'us-west-2', 'version' => 'latest', 'api_provider' => function ($t, $s, $v) use ($provider, $config) { if ($t === 'paginator') { $res = $provider($t, $s, $v); $res['pagination']['ListTables'] = $config + $res['pagination']['ListTables']; return $res; } return $provider($t, $s, $v); } ]); } /** * @dataProvider getPaginatorIterationData */ public function testStandardIterationWorkflow( array $config, array $results, $expectedRequestCount, array $expectedTableNames ) { $requestCount = 0; $client = $this->getCustomClientProvider($config); $this->addMockResults( $client, $results, function () use (&$requestCount) { $requestCount++; } ); $paginator = $client->getPaginator('ListTables'); // Iterate over the paginator and keep track of the keys and values $tableNames = []; $lastKey = $result = null; foreach ($paginator as $key => $result) { $tableNames = array_merge($tableNames, $result['TableNames']); $lastKey = $key; } // Make sure the paginator yields the expected results $this->assertInstanceOf(Result::class, $result); $this->assertEquals($expectedRequestCount, $requestCount); $this->assertEquals($expectedRequestCount - 1, $lastKey); $this->assertEquals($expectedTableNames, $tableNames); } /** * @dataProvider getPaginatorIterationData */ public function testAsyncWorkflow( array $config, array $results, $expectedRequestCount, array $expectedTableNames ) { $client = $this->getCustomClientProvider($config); $this->addMockResults($client, $results); $paginator = $client->getPaginator('ListTables', []); $tables = []; $lastResult = $paginator->each(function (Result $result) use (&$tables) { $tables = array_merge($tables, $result['TableNames']); })->wait(); // Make sure the paginator yields the expected results $this->assertInstanceOf(Result::class, $lastResult); $this->assertEquals($expectedTableNames, $tables); } public function testNonIterator() { // Get test data $config = $this->getPaginatorIterationData()[0][0]; $results = $this->getPaginatorIterationData()[0][1]; // Create the client and paginator $client = $this->getCustomClientProvider($config); $this->addMockResults($client, $results); $paginator = $client->getPaginator('ListTables', [], $config); $this->assertEquals(['test1', 'test2'], $paginator->current()['TableNames']); $this->assertEquals(['NextToken' => 'test2'], $this->getPropertyValue($paginator, 'nextToken'), '[1]'); $paginator->next(); $this->assertEquals([], $paginator->current()['TableNames']); $this->assertEquals(['NextToken' => 'test2'], $this->getPropertyValue($paginator, 'nextToken'), '[2]'); $paginator->next(); $this->assertEquals(['test3'], $paginator->current()['TableNames']); $this->assertEmpty($this->getPropertyValue($paginator, 'nextToken'), '[3]'); } /** * @return array Test data */ public function getPaginatorIterationData() { return [ // Single field token case [ // Config ['input_token' => 'NextToken', 'output_token' => 'LastToken'], // Results [ new Result(['LastToken' => 'test2', 'TableNames' => ['test1', 'test2']]), new Result(['LastToken' => 'test2', 'TableNames' => []]), new Result(['TableNames' => ['test3']]), ], // Request count 3, // Table names ['test1', 'test2', 'test3'], ], [ // Config ['input_token' => ['NT1', 'NT2'], 'output_token' => ['LT1', 'LT2']], // Results [ new Result(['LT1' => 'foo', 'LT2' => 'bar', 'TableNames' => ['test1', 'test2']]), new Result(['LT1' => 'foo', 'LT2' => 'bar', 'TableNames' => []]), new Result(['TableNames' => ['test3']]), ], // Request count 3, // Table names ['test1', 'test2', 'test3'], ], [ // Config ['output_token' => null], // Results [new Result(['TableNames' => ['test1']]),], // Request count 1, // Table names ['test1'], ], [ // Config ['more_results' => 'IsTruncated'], // Results [new Result(['TableNames' => ['test1'], 'IsTruncated' => false]),], // Request count 1, // Table names ['test1'], ], [ // Config ['input_token' => ['NT1', 'NT2', 'NT3'], 'output_token' => ['LT1', 'LT2', 'NT3']], // Results [ new Result(['LT1' => 'foo', 'LT2' => 'bar', 'TableNames' => ['test1', 'test2']]), new Result(['LT1' => 'foo', 'LT2' => 'bar', 'TableNames' => []]), new Result(['TableNames' => ['test3']]), ], // Request count 3, // Table names ['test1', 'test2', 'test3'], ], ]; } public function testCanSearchOverResultsUsingFlatMap() { $requestCount = 0; $client = $this->getCustomClientProvider([ 'input_token' => 'NextToken', 'output_token' => 'LastToken' ]); $this->addMockResults($client, [ new Result(['LastToken' => 'b2', 'TableNames' => ['a1', 'b2']]), new Result(['LastToken' => 'b2', 'TableNames' => []]), new Result(['LastToken' => 'b2', 'TableNames' => ['c3']]), new Result(['TableNames' => ['d4']]), ], function () use (&$requestCount) { $requestCount++; }); $paginator = $client->getPaginator('ListTables'); $tableNames = []; foreach ($paginator->search('TableNames[] | [::-1]') as $table) { $tableNames[] = $table; } $this->assertSame(4, $requestCount); $this->assertEquals(['b2', 'a1', 'c3', 'd4'], $tableNames); } public function testGracefullyHandlesSingleValueResults() { $client = $this->getCustomClientProvider([ 'input_token' => 'NextToken', 'output_token' => 'LastToken' ]); $this->addMockResults($client, [ new Result(['LastToken' => 'b2', 'TableNames' => ['a1', 'b2']]), new Result(['LastToken' => 'b2', 'TableNames' => []]), new Result(['TableNames' => ['c3']]), ]); $paginator = $client->getPaginator('ListTables'); $tableNames = []; foreach ($paginator->search('TableNames[0]') as $table) { $tableNames[] = $table; } $this->assertEquals(['a1', 'c3'], $tableNames); } public function testYieldsReturnedCallbackPromises() { $client = $this->getTestClient('s3'); $results = [ [ 'IsTruncated' => true, 'Contents' => [ ['Key' => 0], ['Key' => 1], ] ], [], [ 'IsTruncated' => false, 'Contents' => [ ['Key' => 2], ['Key' => 3], ] ], [] ]; $handler = function (CommandInterface $cmd, RequestInterface $request) use (&$results, &$cmds) { $cmds[] = $cmd; return Promise\Create::promiseFor( new Result(array_shift($results)) ); }; $client->getHandlerList()->setHandler($handler); $p = $client->getPaginator('ListObjects', ['Bucket' => 'foo']); $promise = $p->each(function ($page) use ($client) { return $client->headObjectAsync([ 'Bucket' => 'foo', 'Key' => implode('.', \JmesPath\search('Contents[].Key', $page)) ]); }); $promise->wait(); $this->assertCount(4, $cmds); $this->assertSame('ListObjects', $cmds[0]->getName()); $this->assertSame('HeadObject', $cmds[1]->getName()); $this->assertSame('ListObjects', $cmds[2]->getName()); $this->assertSame('HeadObject', $cmds[3]->getName()); $this->assertSame('0.1', $cmds[1]['Key']); $this->assertSame('2.3', $cmds[3]['Key']); } public function testMarkerUpdated() { $client = $this->getTestClient('s3'); $objects = [ ['Key' => 0], ['Key' => 1], ['Key' => 2], ['Key' => 3], ['Key' => 4], ]; $handler = function (CommandInterface $cmd, RequestInterface $request) use ($objects, &$cmds) { $cmds[] = $cmd; $result = [ 'IsTruncated' => false, 'Contents' => [] ]; foreach ($objects as $object) { if ($object['Key'] <= $cmd['Marker']) { continue; } $result['Contents'] []= $object; if (count($result['Contents']) >= $cmd['MaxKeys']) { $result['IsTruncated'] = true; break; } } return Promise\Create::promiseFor(new Result($result)); }; $client->getHandlerList()->setHandler($handler); $p = $client->getPaginator('ListObjects', [ 'Bucket' => 'foo', 'Marker' => 1, 'MaxKeys' => 2, ]); $resultSets = 0; $promise = $p->each(function ($page) use ($client, &$resultSets) { if ($resultSets++ > 1) { $this->fail('Marker has not moved.'); } return $client->headObjectAsync([ 'Bucket' => 'foo', 'Key' => implode('.', \JmesPath\search('Contents[].Key', $page)) ]); }); $promise->wait(); $this->assertCount(4, $cmds); $this->assertSame('ListObjects', $cmds[0]->getName()); $this->assertSame('HeadObject', $cmds[1]->getName()); $this->assertSame('ListObjects', $cmds[2]->getName()); $this->assertSame('HeadObject', $cmds[3]->getName()); $this->assertSame('2.3', $cmds[1]['Key']); $this->assertSame('4', $cmds[3]['Key']); } public function testDoesNotInsertMissingOutputTokensIntoNextRequest() { $client = $this->getTestClient('route53'); $pagingChatter = [ [ 'request' => [], 'response' => [ 'IsTruncated' => true, "NextRecordName" => 'foo', "NextRecordType" => 'bar', 'ResourceRecordSets' => [['ResourceId' => 'a']], ], ], [ 'request' => [ 'StartRecordName' => 'foo', 'StartRecordType' => 'bar', ], 'response' => [ 'IsTruncated' => true, "NextRecordName" => 'foo', "NextRecordType" => 'bar', "NextRecordIdentifier" => 'baz', 'ResourceRecordSets' => [['ResourceId' => 'b']], ], ], [ 'request' => [ 'StartRecordName' => 'foo', 'StartRecordType' => 'bar', 'StartRecordIdentifier' => 'baz', ], 'response' => [ 'IsTruncated' => true, "NextRecordName" => 'foo', "NextRecordType" => 'bar', 'ResourceRecordSets' => [['ResourceId' => 'c']], ], ], [ 'request' => [ 'StartRecordName' => 'foo', 'StartRecordType' => 'bar', ], 'response' => [ 'IsTruncated' => false, 'ResourceRecordSets' => [['ResourceId' => 'd']], ], ] ]; $handler = function (CommandInterface $cmd, RequestInterface $request) use (&$pagingChatter) { $currentWindow = array_shift($pagingChatter); foreach ($currentWindow['request'] as $expectedKey => $expectedValue) { $this->assertArrayHasKey($expectedKey, $cmd); $this->assertSame($expectedValue, $cmd[$expectedKey]); } return Promise\Create::promiseFor( new Result($currentWindow['response']) ); }; $client->getHandlerList()->setHandler($handler); $paginator = $client->getPaginator('ListResourceRecordSets', ['HostedZoneId' => 'id']); $setIds = []; foreach ($paginator->search('a') as $b) { } } public function testLastPageHasPreviousToken() { $config = ['input_token' => 'nextToken', 'output_token' => 'nextForwardToken']; $provider = ApiProvider::defaultProvider(); $client = new CloudWatchLogsClient([ 'region' => 'us-west-2', 'version' => 'latest', 'api_provider' => function ($t, $s, $v) use ($provider, $config) { if ($t === 'paginator') { $res = $provider($t, $s, $v); $res['pagination']['GetLogEvents'] = $config + $res['pagination']['GetLogEvents']; return $res; } return $provider($t, $s, $v); } ]); $results = [ new Result(['nextToken' => 'foo', 'nextForwardToken' => 'foo']), new Result(['nextToken' => 'bar', 'nextForwardToken' => 'bar']), new Result(['nextToken' => 'bar', 'nextForwardToken' => 'bar']), new Result(['nextToken' => 'baz', 'nextForwardToken' => 'baz']), ]; $requestCount = 0; $this->addMockResults( $client, $results, function () use (&$requestCount) { $requestCount++; } ); $paginator = $client->getPaginator('GetLogEvents', [ "logGroupName" => "foo", "logStreamName" => 'bar', ]); // Iterate over the paginator foreach ($paginator as $key => $result) {} // Make sure the paginator yields the expected results $this->assertInstanceOf(Result::class, $result); $this->assertEquals(3, $requestCount); } }