OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
knoblyExpressLandingPage
/
vendor
/
aws
/
aws-sdk-php
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/21/2024 10:02:53 AM
rwxr-xr-x
📄
AbstractConfigurationProviderTest.php
3.42 KB
08/21/2024 10:02:26 AM
rw-r--r--
📁
Api
-
08/21/2024 10:11:35 AM
rwxr-xr-x
📁
Arn
-
08/21/2024 10:05:32 AM
rwxr-xr-x
📁
Auth
-
08/21/2024 10:03:48 AM
rwxr-xr-x
📄
AwsClientTest.php
29.67 KB
08/21/2024 10:02:26 AM
rw-r--r--
📁
Build
-
08/21/2024 10:05:32 AM
rwxr-xr-x
📄
ClientResolverTest.php
55.74 KB
08/21/2024 10:02:26 AM
rw-r--r--
📁
ClientSideMonitoring
-
08/21/2024 10:03:49 AM
rwxr-xr-x
📁
CloudFront
-
08/21/2024 10:05:32 AM
rwxr-xr-x
📁
CloudSearchDomain
-
08/21/2024 10:03:49 AM
rwxr-xr-x
📁
CloudTrail
-
08/21/2024 10:03:49 AM
rwxr-xr-x
📁
CloudWatchLogs
-
08/21/2024 10:03:50 AM
rwxr-xr-x
📁
CognitoIdentity
-
08/21/2024 10:03:50 AM
rwxr-xr-x
📁
CognitoSync
-
08/21/2024 10:03:50 AM
rwxr-xr-x
📄
CommandPoolTest.php
5.8 KB
08/21/2024 10:02:26 AM
rw-r--r--
📄
CommandTest.php
3.28 KB
08/21/2024 10:02:26 AM
rw-r--r--
📄
ConfigurationResolverTest.php
12.35 KB
08/21/2024 10:02:26 AM
rw-r--r--
📁
Credentials
-
08/21/2024 10:11:26 AM
rwxr-xr-x
📁
Crypto
-
08/21/2024 10:05:32 AM
rwxr-xr-x
📁
DefaultsMode
-
08/21/2024 10:03:51 AM
rwxr-xr-x
📁
DocDb
-
08/21/2024 10:03:51 AM
rwxr-xr-x
📄
DoctrineCacheAdapterTest.php
1.23 KB
08/21/2024 10:02:26 AM
rw-r--r--
📁
DynamoDb
-
08/21/2024 10:03:52 AM
rwxr-xr-x
📁
Ec2
-
08/21/2024 10:03:52 AM
rwxr-xr-x
📁
ElasticLoadBalancingV2
-
08/21/2024 10:03:52 AM
rwxr-xr-x
📁
Endpoint
-
08/21/2024 10:05:33 AM
rwxr-xr-x
📁
EndpointDiscovery
-
08/21/2024 10:11:36 AM
rwxr-xr-x
📄
EndpointParameterMiddlewareTest.php
9.21 KB
08/21/2024 10:02:26 AM
rw-r--r--
📁
EndpointV2
-
08/21/2024 10:05:34 AM
rwxr-xr-x
📁
EventBridge
-
08/21/2024 10:03:53 AM
rwxr-xr-x
📁
Exception
-
08/21/2024 10:03:53 AM
rwxr-xr-x
📄
FunctionsTest.php
14.33 KB
08/21/2024 10:02:26 AM
rw-r--r--
📁
Glacier
-
08/21/2024 10:03:53 AM
rwxr-xr-x
📁
Handler
-
08/21/2024 10:05:34 AM
rwxr-xr-x
📄
HandlerListTest.php
7.16 KB
08/21/2024 10:02:26 AM
rw-r--r--
📄
HasMonitoringEventsTraitTest.php
895 bytes
08/21/2024 10:02:27 AM
rw-r--r--
📄
HashingStreamTest.php
1.41 KB
08/21/2024 10:02:26 AM
rw-r--r--
📄
HistoryTest.php
4.2 KB
08/21/2024 10:02:27 AM
rw-r--r--
📄
IdempotencyTokenMiddlewareTest.php
2.76 KB
08/21/2024 10:02:27 AM
rw-r--r--
📁
Identity
-
08/21/2024 10:05:35 AM
rwxr-xr-x
📄
InputValidationMiddlewareTest.php
5.62 KB
08/21/2024 10:02:27 AM
rw-r--r--
📁
Integ
-
08/21/2024 10:03:54 AM
rwxr-xr-x
📄
JsonCompilerTest.php
730 bytes
08/21/2024 10:02:27 AM
rw-r--r--
📁
Lambda
-
08/21/2024 10:03:54 AM
rwxr-xr-x
📁
LexModelsV2
-
08/21/2024 10:03:54 AM
rwxr-xr-x
📄
LruArrayCacheTest.php
1.59 KB
08/21/2024 10:02:27 AM
rw-r--r--
📁
MachineLearning
-
08/21/2024 10:03:54 AM
rwxr-xr-x
📄
MiddlewareTest.php
16.08 KB
08/21/2024 10:02:27 AM
rw-r--r--
📄
MockHandlerTest.php
3.79 KB
08/21/2024 10:02:27 AM
rw-r--r--
📄
MultiRegionClientTest.php
5.41 KB
08/21/2024 10:02:27 AM
rw-r--r--
📁
Multipart
-
08/21/2024 10:03:55 AM
rwxr-xr-x
📁
Neptune
-
08/21/2024 10:03:55 AM
rwxr-xr-x
📄
PerformanceContext.php
8.2 KB
08/21/2024 10:02:27 AM
rw-r--r--
📄
PhpHashTest.php
1.33 KB
08/21/2024 10:02:27 AM
rw-r--r--
📁
Polly
-
08/21/2024 10:03:55 AM
rwxr-xr-x
📄
PresignUrlMiddlewareTest.php
3.95 KB
08/21/2024 10:02:27 AM
rw-r--r--
📄
Psr16CacheAdapterTest.php
1.84 KB
08/21/2024 10:02:27 AM
rw-r--r--
📄
PsrCacheAdapterTest.php
2.64 KB
08/21/2024 10:02:27 AM
rw-r--r--
📄
QueryCompatibleInputMiddlewareTest.php
9.1 KB
08/21/2024 10:02:27 AM
rw-r--r--
📁
Rds
-
08/21/2024 10:03:55 AM
rwxr-xr-x
📁
RequestCompression
-
08/21/2024 10:05:35 AM
rwxr-xr-x
📄
ResultPaginatorTest.php
16.21 KB
08/21/2024 10:02:27 AM
rw-r--r--
📄
ResultTest.php
1.38 KB
08/21/2024 10:02:27 AM
rw-r--r--
📁
Retry
-
08/21/2024 10:03:55 AM
rwxr-xr-x
📄
RetryMiddlewareTest.php
24.57 KB
08/21/2024 10:02:27 AM
rw-r--r--
📄
RetryMiddlewareV2Test.php
40.33 KB
08/21/2024 10:02:27 AM
rw-r--r--
📁
Route53
-
08/21/2024 10:03:56 AM
rwxr-xr-x
📁
S3
-
08/21/2024 10:11:36 AM
rwxr-xr-x
📁
S3Control
-
08/21/2024 10:03:57 AM
rwxr-xr-x
📁
Script
-
08/21/2024 10:03:57 AM
rwxr-xr-x
📄
SdkTest.php
2.37 KB
08/21/2024 10:02:27 AM
rw-r--r--
📁
Ses
-
08/21/2024 10:03:57 AM
rwxr-xr-x
📁
Signature
-
08/21/2024 10:03:58 AM
rwxr-xr-x
📁
Sqs
-
08/21/2024 10:03:58 AM
rwxr-xr-x
📁
Ssm
-
08/21/2024 10:03:58 AM
rwxr-xr-x
📄
StreamRequestPayloadMiddlewareTest.php
10.1 KB
08/21/2024 10:02:27 AM
rw-r--r--
📁
Sts
-
08/21/2024 10:05:36 AM
rwxr-xr-x
📄
TestServiceTrait.php
3.78 KB
08/21/2024 10:02:27 AM
rw-r--r--
📁
Token
-
08/21/2024 10:03:58 AM
rwxr-xr-x
📄
TraceMiddlewareTest.php
16.16 KB
08/21/2024 10:02:28 AM
rw-r--r--
📄
UsesServiceTrait.php
4.37 KB
08/21/2024 10:02:28 AM
rw-r--r--
📄
WaiterTest.php
12.63 KB
08/21/2024 10:02:28 AM
rw-r--r--
📄
WrappedHttpHandlerTest.php
13.8 KB
08/21/2024 10:02:28 AM
rw-r--r--
📁
bootstrap
-
08/21/2024 10:03:49 AM
rwxr-xr-x
📄
bootstrap.php
1.53 KB
08/21/2024 10:02:26 AM
rw-r--r--
📁
fixtures
-
08/21/2024 10:11:36 AM
rwxr-xr-x
📁
static
-
08/21/2024 10:03:58 AM
rwxr-xr-x
Editing: ConfigurationResolverTest.php
Close
<?php namespace Aws\Test; use Aws\Configuration\ConfigurationResolver; use Yoast\PHPUnitPolyfills\TestCases\TestCase; class ConfigurationResolverTest extends TestCase { private static $configurationKey = 'foo_configuration_option'; private static $originalEnv; private $boolIniFile = <<<EOT [custom] foo_configuration_option = false [default] foo_configuration_option = true EOT; private $intIniFile = <<<EOT [custom] foo_configuration_option = 25 [default] foo_configuration_option = 15 EOT; private $stringIniFile = <<<EOT [custom] foo_configuration_option = experimental [default] foo_configuration_option = standard EOT; private $servicesIniFile = <<<EOT [default] foo_configuration_option = standard services = my-services [services my-services] s3 = endpoint_url = https://exmaple.com EOT; public static function set_up_before_class() { self::$originalEnv = [ 'foo_configuration_option' => getenv( ConfigurationResolver::$envPrefix . strtoupper(self::$configurationKey) ) ?: '', 'home' => getenv('HOME') ?: '', 'profile' => getenv(ConfigurationResolver::ENV_PROFILE) ?: '', 'config_file' => getenv(ConfigurationResolver::ENV_CONFIG_FILE) ?: '', ]; } private function clearEnv() { putenv( ConfigurationResolver::$envPrefix . strtoupper(self::$configurationKey) . '=' ); putenv(ConfigurationResolver::ENV_PROFILE . '='); putenv(ConfigurationResolver::ENV_CONFIG_FILE . '='); $dir = sys_get_temp_dir() . '/.aws'; if (!is_dir($dir)) { mkdir($dir, 0777, true); } return $dir; } public static function tear_down_after_class() { putenv(ConfigurationResolver::$envPrefix . strtoupper(self::$configurationKey) . '=' . self::$originalEnv['foo_configuration_option']); putenv('HOME=' . self::$originalEnv['home']); putenv(ConfigurationResolver::ENV_PROFILE . '=' . self::$originalEnv['profile']); putenv(ConfigurationResolver::ENV_CONFIG_FILE . '=' . self::$originalEnv['config_file']); } public function getEnvValues() { return [ ['true', 'bool', true], ['false', 'bool', false], ['25', 'int', 25], ['some value', 'string', 'some value'] ]; } /** * @dataProvider getEnvValues */ public function testRetrievesAndConvertsEnvironmentVariables($envValue, $type, $expected) { $this->clearEnv(); putenv( ConfigurationResolver::$envPrefix . strtoupper(self::$configurationKey) . '=' . $envValue ); $result = ConfigurationResolver::env(self::$configurationKey, $type); $this->assertSame($expected, $result); } public function testNoEnvReturnsNull() { $this->clearEnv(); putenv(ConfigurationResolver::$envPrefix . strtoupper(self::$configurationKey)); $result = ConfigurationResolver::env(self::$configurationKey, 'string'); $this->assertNull($result); } public function testResolvesDefaultFromFallback() { $this->clearEnv(); $result = ConfigurationResolver::resolve( self::$configurationKey, false, 'bool' ); $this->assertFalse($result); } public function iniFileProvider() { return [ [$this->boolIniFile, 'bool', true], [$this->intIniFile, 'int', 15], [$this->stringIniFile, 'string', 'standard'], ]; } /** * @dataProvider IniFileProvider */ public function testResolvesFromIniFileWithDefaultProfile($iniFile, $type, $expected) { $dir = $this->clearEnv(); file_put_contents($dir . '/config', $iniFile); putenv('HOME=' . dirname($dir)); $result = ConfigurationResolver::ini(self::$configurationKey, $type); $this->assertSame($expected, $result); unlink($dir . '/config'); } /** * @dataProvider IniFileProvider */ public function testCreatesFromIniFileWithDifferentDefaultFilename($iniFile, $type, $expected) { $dir = $this->clearEnv(); putenv(ConfigurationResolver::ENV_CONFIG_FILE . '=' . $dir . "/alt_config"); file_put_contents($dir . '/config', $iniFile); file_put_contents($dir . '/alt_config', $iniFile); putenv('HOME=' . dirname($dir)); /** @var ConfigurationInterface $result */ $result = $result = ConfigurationResolver::ini(self::$configurationKey, $type); $this->assertSame($expected, $result); unlink($dir . '/config'); unlink($dir . '/alt_config'); } public function iniFileWithAltProfileProvider() { return [ [$this->boolIniFile, 'bool', false], [$this->intIniFile, 'int', 25], [$this->stringIniFile, 'string', 'experimental'], ]; } /** * @dataProvider IniFileWIthAltProfileProvider */ public function testCreatesFromIniFileWithSpecifiedProfile($iniFile, $type, $expected) { $dir = $this->clearEnv(); file_put_contents($dir . '/config', $iniFile); putenv('HOME=' . dirname($dir)); putenv(ConfigurationResolver::ENV_PROFILE . '=custom'); $result = ConfigurationResolver::ini(self::$configurationKey, $type); $this->assertEquals($expected, $result); unlink($dir . '/config'); } public function testEnsuresIniFileExists() { $this->clearEnv(); putenv('HOME=/does/not/exist'); $result = ConfigurationResolver::ini(self::$configurationKey, 'bool'); $this->assertNull($result); } public function testReturnsNullIfProfileDoesNotExist() { $dir = $this->clearEnv(); $ini = "[foo]"; file_put_contents($dir . '/config', $ini); putenv('HOME=' . dirname($dir)); $result = ConfigurationResolver::ini(self::$configurationKey, 'bool'); $this->assertNull($result); } public function testReturnsNullIfIniFileIsEmpty() { $dir = $this->clearEnv(); file_put_contents($dir . '/config', ''); putenv('HOME=' . dirname($dir)); $result = ConfigurationResolver::ini(self::$configurationKey, 'bool'); $this->assertNull($result); } public function testEnsuresIniFileIsValid() { $dir = $this->clearEnv(); file_put_contents($dir . '/config', "wef \n=\nwef"); putenv('HOME=' . dirname($dir)); $result = ConfigurationResolver::ini(self::$configurationKey, 'bool'); $this->assertNull($result); } public function testGetsHomeDirectoryForWindowsUsers() { putenv('HOME='); putenv('HOMEDRIVE=C:'); putenv('HOMEPATH=\\Sean\\Home'); $ref = new \ReflectionClass(ConfigurationResolver::class); $meth = $ref->getMethod('getHomeDir'); $meth->setAccessible(true); $this->assertSame('C:\\Sean\\Home', $meth->invoke(null)); } public function testSelectsEnvironmentOverIniConfiguration() { $dir = $this->clearEnv(); putenv( ConfigurationResolver::$envPrefix . strtoupper(self::$configurationKey) . '=true' ); file_put_contents($dir . '/config', $this->boolIniFile); putenv('HOME=' . dirname($dir)); putenv(ConfigurationResolver::ENV_PROFILE . '=custom'); $result = ConfigurationResolver::resolve( self::$configurationKey, false, 'bool' ); $this->assertTrue($result); unlink($dir . '/config'); } public function testUsesIniWithUseAwsConfigFileTrue() { $dir = $this->clearEnv(); file_put_contents($dir . '/config', $this->boolIniFile); putenv('HOME=' . dirname($dir)); $result = ConfigurationResolver::resolve( self::$configurationKey, false, 'bool', ['use_aws_shared_config_files' => true] ); $this->assertTrue($result); unlink($dir . '/config'); } public function testIgnoresIniWithUseAwsConfigFileFalse() { $dir = $this->clearEnv(); file_put_contents($dir . '/config', $this->boolIniFile); putenv('HOME=' . dirname($dir)); $result = ConfigurationResolver::resolve( self::$configurationKey, false, 'bool', ['use_aws_shared_config_files' => false] ); $this->assertFalse($result); unlink($dir . '/config'); } public function testResolvesServiceEnv() { $dir = $this->clearEnv(); putenv( ConfigurationResolver::$envPrefix . 'ENDPOINT_URL_S3' . '=' . 'https://test.com' ); file_put_contents($dir . '/config', $this->servicesIniFile); putenv('HOME=' . dirname($dir)); $result = ConfigurationResolver::resolve( 'endpoint_url_s3', '', 'string', [ 'config_resolver_options' => [ 'service' => 's3', 'key' => 'endpoint_url' ] ] ); $this->assertSame('https://test.com', $result); putenv( ConfigurationResolver::$envPrefix . 'ENDPOINT_URL_S3' . '=' ); } public function testResolvesServiceIni() { $dir = $this->clearEnv(); putenv( ConfigurationResolver::$envPrefix . 'ENDPOINT_URL' . '=' . 'https://test.com' ); file_put_contents($dir . '/config', $this->servicesIniFile); putenv('HOME=' . dirname($dir)); $result = ConfigurationResolver::resolve( 'endpoint_url_s3', '', 'string', [ 'ini_resolver_options' => [ 'section' => 'services', 'subsection' => 's3', 'key' => 'endpoint_url' ] ] ); $this->assertSame('https://exmaple.com', $result); putenv( ConfigurationResolver::$envPrefix . 'ENDPOINT_URL' . '=' ); } /** * @dataProvider duplicateIniFileProvider */ public function testResolvesServiceIniWithDuplicateSections($ini) { $dir = $this->clearEnv(); putenv( ConfigurationResolver::$envPrefix . 'ENDPOINT_URL' . '=' . 'https://test.com' ); file_put_contents($dir . '/config', $ini); putenv('HOME=' . dirname($dir)); $result = ConfigurationResolver::resolve( 'endpoint_url_s3', '', 'string', [ 'ini_resolver_options' => [ 'section' => 'services', 'subsection' => 's3', 'key' => 'endpoint_url' ] ] ); $this->assertSame('https://exmaple.com', $result); putenv( ConfigurationResolver::$envPrefix . 'ENDPOINT_URL' . '=' ); } public function duplicateIniFileProvider() { return [ [ <<<EOT [default] foo_configuration_option = standard services = my-services [services my-services] s3 = endpoint_url = https://foo.com foo = bar_option = baz [services my-services] s3 = endpoint_url = https://exmaple.com foo = bar_option = foo EOT ], [ <<<EOT [default] foo_configuration_option = standard services = my-services [services my-services] s3 = endpoint_url = https://foo.com foo = bar_option = baz [profile foo] endpoint_url = https://bar.com [services my-services] s3 = endpoint_url = https://exmaple.com foo = bar_option = foo EOT ] ]; } }