OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
reader
/
aws-ses
/
vendor
/
aws
/
aws-sdk-php
/
tests
/
Api
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/19/2025 10:07:15 AM
rwxr-xr-x
📄
ApiProviderTest.php
4.29 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
DateTimeResultTest.php
1.58 KB
05/19/2025 10:07:15 AM
rw-r--r--
📁
ErrorParser
-
05/19/2025 10:07:15 AM
rwxr-xr-x
📄
ListShapeTest.php
786 bytes
05/19/2025 10:07:15 AM
rw-r--r--
📄
MapShapeTest.php
1.15 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
OperationTest.php
3.93 KB
05/19/2025 10:07:15 AM
rw-r--r--
📁
Parser
-
05/19/2025 10:07:15 AM
rwxr-xr-x
📁
Serializer
-
05/19/2025 10:07:15 AM
rwxr-xr-x
📄
ServiceTest.php
9.2 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
ShapeMapTest.php
949 bytes
05/19/2025 10:07:15 AM
rw-r--r--
📄
ShapeTest.php
2.97 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
Stringable.php
137 bytes
05/19/2025 10:07:15 AM
rw-r--r--
📄
StructureShapeTest.php
1.62 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
TimestampShapeTest.php
1.89 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
ValidatorTest.php
24.8 KB
05/19/2025 10:07:15 AM
rw-r--r--
📁
api_provider_fixtures
-
03/03/2025 08:45:24 AM
rwxr-xr-x
📁
eventstream_fixtures
-
03/03/2025 08:57:40 AM
rwxr-xr-x
Editing: ApiProviderTest.php
Close
<?php namespace Aws\Test\Api; use Aws\Api\ApiProvider; use Aws\Exception\UnresolvedApiException; use Yoast\PHPUnitPolyfills\TestCases\TestCase; /** * @covers Aws\Api\ApiProvider */ class ApiProviderTest extends TestCase { /** * @return ApiProvider; */ private function getTestApiProvider($useManifest = true) { $dir = __DIR__ . '/api_provider_fixtures'; $manifest = json_decode(file_get_contents($dir . '/manifest.json'), true); return $useManifest ? ApiProvider::manifest($dir, $manifest) : ApiProvider::filesystem($dir); } public function testCanResolveProvider() { $p = function ($a, $b, $c) {return [];}; $result = ['metadata'=> ['serviceIdentifier' => 's']]; $this->assertEquals($result, ApiProvider::resolve($p, 't', 's', 'v')); $p = function ($a, $b, $c) {return null;}; $this->expectException(UnresolvedApiException::class); ApiProvider::resolve($p, 't', 's', 'v'); } public function testCanGetServiceVersions() { $mp = $this->getTestApiProvider(); $this->assertEquals( ['2012-08-10', '2010-02-04'], $mp->getVersions('dynamodb') ); $this->assertEquals([], $mp->getVersions('foo')); $fp = $this->getTestApiProvider(false); $this->assertEquals( ['2012-08-10', '2010-02-04'], $fp->getVersions('dynamodb') ); } public function testCanGetDefaultProvider() { $p = ApiProvider::defaultProvider(); $this->assertArrayHasKey('s3', $this->getPropertyValue($p, 'manifest')); } public function testManifestProviderReturnsNullForMissingService() { $p = $this->getTestApiProvider(); $this->assertNull($p('api', 'foo', '2015-02-02')); } public function testManifestProviderCanLoadData() { $p = $this->getTestApiProvider(); $data = $p('api', 'dynamodb', 'latest'); $this->assertIsArray($data); $this->assertArrayHasKey('foo', $data); } public function testFilesystemProviderEnsuresDirectoryIsValid() { $this->expectException(\InvalidArgumentException::class); ApiProvider::filesystem('/path/to/invalid/dir'); } public function testNullOnMissingFile() { $p = $this->getTestApiProvider(); $this->assertNull($p('api', 'nofile', 'latest')); } public function testReturnsLatestServiceData() { $p = ApiProvider::filesystem(__DIR__ . '/api_provider_fixtures'); $this->assertEquals(['foo' => 'bar'], $p('api', 'dynamodb', 'latest')); } public function testReturnsNullWhenNoLatestVersionIsAvailable() { $p = ApiProvider::filesystem(__DIR__ . '/api_provider_fixtures'); $this->assertnull($p('api', 'dodo', 'latest')); } public function testReturnsPaginatorConfigsForLatestCompatibleVersion() { $p = $this->getTestApiProvider(); $result = $p('paginator', 'dynamodb', 'latest'); $this->assertEquals(['abc' => '123'], $result); $result = $p('paginator', 'dynamodb', '2011-12-05'); $this->assertEquals(['abc' => '123'], $result); } public function testReturnsWaiterConfigsForLatestCompatibleVersion() { $p = $this->getTestApiProvider(); $result = $p('waiter', 'dynamodb', 'latest'); $this->assertEquals(['abc' => '456'], $result); $result = $p('waiter', 'dynamodb', '2011-12-05'); $this->assertEquals(['abc' => '456'], $result); } public function testThrowsOnBadType() { $this->expectException(UnresolvedApiException::class); $p = $this->getTestApiProvider(); ApiProvider::resolve($p, 'foo', 's3', 'latest'); } public function testThrowsOnBadService() { $this->expectException(UnresolvedApiException::class); $p = $this->getTestApiProvider(); ApiProvider::resolve($p, 'api', '', 'latest'); } public function testThrowsOnBadVersion() { $this->expectException(UnresolvedApiException::class); $p = $this->getTestApiProvider(); ApiProvider::resolve($p, 'api', 'dynamodb', 'derp'); } }