From 8bec661288b276c98bdb0e773e5f4d5275dc4c87 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 20 Oct 2023 16:44:35 +0300 Subject: update AWK SDK --- vendor/aws/aws-crt-php/tests/000_CoreTest.php | 22 --- vendor/aws/aws-crt-php/tests/CrcTest.php | 90 ----------- vendor/aws/aws-crt-php/tests/CredentialsTest.php | 46 ------ vendor/aws/aws-crt-php/tests/ErrorTest.php | 21 --- .../aws/aws-crt-php/tests/EventLoopGroupTest.php | 25 --- vendor/aws/aws-crt-php/tests/HttpMessageTest.php | 95 ----------- vendor/aws/aws-crt-php/tests/LogTest.php | 23 --- vendor/aws/aws-crt-php/tests/SigningTest.php | 176 --------------------- vendor/aws/aws-crt-php/tests/StreamTest.php | 34 ---- vendor/aws/aws-crt-php/tests/common.inc | 34 ---- 10 files changed, 566 deletions(-) delete mode 100644 vendor/aws/aws-crt-php/tests/000_CoreTest.php delete mode 100644 vendor/aws/aws-crt-php/tests/CrcTest.php delete mode 100644 vendor/aws/aws-crt-php/tests/CredentialsTest.php delete mode 100644 vendor/aws/aws-crt-php/tests/ErrorTest.php delete mode 100644 vendor/aws/aws-crt-php/tests/EventLoopGroupTest.php delete mode 100644 vendor/aws/aws-crt-php/tests/HttpMessageTest.php delete mode 100644 vendor/aws/aws-crt-php/tests/LogTest.php delete mode 100644 vendor/aws/aws-crt-php/tests/SigningTest.php delete mode 100644 vendor/aws/aws-crt-php/tests/StreamTest.php delete mode 100644 vendor/aws/aws-crt-php/tests/common.inc (limited to 'vendor/aws/aws-crt-php/tests') diff --git a/vendor/aws/aws-crt-php/tests/000_CoreTest.php b/vendor/aws/aws-crt-php/tests/000_CoreTest.php deleted file mode 100644 index e9e068a..0000000 --- a/vendor/aws/aws-crt-php/tests/000_CoreTest.php +++ /dev/null @@ -1,22 +0,0 @@ -assertTrue(CRT::isAvailable()); - } - - // We have done nothing to necessitate loading the CRT, it should not be loaded - public function testIsLoaded() { - $this->assertTrue(!CRT::isLoaded()); - } -} \ No newline at end of file diff --git a/vendor/aws/aws-crt-php/tests/CrcTest.php b/vendor/aws/aws-crt-php/tests/CrcTest.php deleted file mode 100644 index 56c5038..0000000 --- a/vendor/aws/aws-crt-php/tests/CrcTest.php +++ /dev/null @@ -1,90 +0,0 @@ -assertEquals($output, $expected); - } - - public function testCrc32ZeroesIterated() { - $output = 0; - for ($i = 0; $i < 32; $i++) { - $output = CRT::crc32("\x00", $output); - } - $expected = 0x190A55AD; - $this->assertEquals($output, $expected); - } - - public function testCrc32ValuesOneShot() { - $input = implode(array_map("chr", range(0, 31))); - $output = CRT::crc32($input); - $expected = 0x91267E8A; - $this->assertEquals($output, $expected); - } - - public function testCrc32ValuesIterated() { - $output = 0; - foreach (range(0, 31) as $n) { - $output = CRT::crc32(chr($n), $output); - } - $expected = 0x91267E8A; - $this->assertEquals($output, $expected); - } - - public function testCrc32LargeBuffer() { - $input = implode(array_map("chr", array_fill(0, 1 << 20, 0))); - $output = CRT::crc32($input); - $expected = 0xA738EA1C; - $this->assertEquals($output, $expected); - } - - public function testCrc32cZeroesOneShot() { - $input = implode(array_map("chr", array_fill(0, 32, 0))); - $output = CRT::crc32c($input); - $expected = 0x8A9136AA; - $this->assertEquals($output, $expected); - } - - public function testCrc32cZeroesIterated() { - $output = 0; - for ($i = 0; $i < 32; $i++) { - $output = CRT::crc32c("\x00", $output); - } - $expected = 0x8A9136AA; - $this->assertEquals($output, $expected); - } - - public function testCrc32cValuesOneShot() { - $input = implode(array_map("chr", range(0, 31))); - $output = CRT::crc32c($input); - $expected = 0x46DD794E; - $this->assertEquals($output, $expected); - } - - public function testCrc32cValuesIterated() { - $output = 0; - foreach (range(0, 31) as $n) { - $output = CRT::crc32c(chr($n), $output); - } - $expected = 0x46DD794E; - $this->assertEquals($output, $expected); - } - - public function testCrc32cLargeBuffer() { - $input = implode(array_map("chr", array_fill(0, 1 << 20, 0))); - $output = CRT::crc32c($input); - $expected = 0x14298C12; - $this->assertEquals($output, $expected); - } - -} diff --git a/vendor/aws/aws-crt-php/tests/CredentialsTest.php b/vendor/aws/aws-crt-php/tests/CredentialsTest.php deleted file mode 100644 index 32a9c42..0000000 --- a/vendor/aws/aws-crt-php/tests/CredentialsTest.php +++ /dev/null @@ -1,46 +0,0 @@ -expectException(InvalidArgumentException::class); - $creds = new AwsCredentials(AwsCredentials::defaults()); - $this->assertNotNull($creds, "Failed to create default/empty credentials"); - $creds = null; - } - - private function getCredentialsConfig() { - $options = AwsCredentials::defaults(); - $options['access_key_id'] = 'TESTAWSACCESSKEYID'; - $options['secret_access_key'] = 'TESTSECRETaccesskeyThatDefinitelyDoesntWork'; - $options['session_token'] = 'ThisIsMyTestSessionTokenIMadeItUpMyself'; - $options['expiration_timepoint_seconds'] = 42; - return $options; - } - - public function testCredentialsLifetime() { - $options = $this->getCredentialsConfig(); - $creds = new AwsCredentials($options); - $this->assertNotNull($creds, "Failed to create Credentials with options"); - $this->assertEquals($creds->access_key_id, $options['access_key_id']); - $this->assertEquals($creds->secret_access_key, $options['secret_access_key']); - $this->assertEquals($creds->session_token, $options['session_token']); - $this->assertEquals($creds->expiration_timepoint_seconds, $options['expiration_timepoint_seconds']); - $creds = null; - } - - public function testStaticCredentialsProviderLifetime() { - $options = $this->getCredentialsConfig(); - $provider = new StaticCredentialsProvider($options); - $this->assertNotNull($provider, "Failed to create StaticCredentialsProvider"); - $provider = null; - } -} diff --git a/vendor/aws/aws-crt-php/tests/ErrorTest.php b/vendor/aws/aws-crt-php/tests/ErrorTest.php deleted file mode 100644 index e84d1ed..0000000 --- a/vendor/aws/aws-crt-php/tests/ErrorTest.php +++ /dev/null @@ -1,21 +0,0 @@ -assertEquals(0, CRT::last_error()); - } - - public function testCanResolveErrorName() { - $this->assertEquals("AWS_ERROR_SUCCESS", CRT::error_name(0)); - } - - public function testCanResolveErrorStr() { - $this->assertEquals("Success.", CRT::error_str(0)); - } -} diff --git a/vendor/aws/aws-crt-php/tests/EventLoopGroupTest.php b/vendor/aws/aws-crt-php/tests/EventLoopGroupTest.php deleted file mode 100644 index 6a52c69..0000000 --- a/vendor/aws/aws-crt-php/tests/EventLoopGroupTest.php +++ /dev/null @@ -1,25 +0,0 @@ -assertNotNull($elg, "Failed to create default EventLoopGroup"); - $elg = null; - } - - public function testConstructionWithOptions() { - $options = EventLoopGroup::defaults(); - $options['num_threads'] = 1; - $elg = new EventLoopGroup($options); - $this->assertNotNull($elg, "Failed to create EventLoopGroup with 1 thread"); - $elg = null; - } -} diff --git a/vendor/aws/aws-crt-php/tests/HttpMessageTest.php b/vendor/aws/aws-crt-php/tests/HttpMessageTest.php deleted file mode 100644 index eec18b6..0000000 --- a/vendor/aws/aws-crt-php/tests/HttpMessageTest.php +++ /dev/null @@ -1,95 +0,0 @@ -assertSame(0, $headers->count()); - } - - public function testHeadersMarshalling() { - $headers_array = [ - "host" => "s3.amazonaws.com", - "test" => "this is a test header value" - ]; - $headers = new Headers($headers_array); - $this->assertSame(2, $headers->count()); - $this->assertSame($headers_array['host'], $headers->get('host')); - $this->assertSame($headers_array['test'], $headers->get('test')); - $buffer = Headers::marshall($headers); - $headers_copy = Headers::unmarshall($buffer); - $this->assertSame(2, $headers_copy->count()); - $this->assertSame($headers_array['host'], $headers_copy->get('host')); - $this->assertSame($headers_array['test'], $headers_copy->get('test')); - } - - private function assertMessagesMatch($a, $b) { - $this->assertSame($a->method(), $b->method()); - $this->assertSame($a->path(), $b->path()); - $this->assertSame($a->query(), $b->query()); - $this->assertSame($a->headers()->toArray(), $b->headers()->toArray()); - } - - public function testRequestMarshalling() { - $headers = [ - "host" => "s3.amazonaws.com", - "test" => "this is a test header value" - ]; - $method = "GET"; - $path = "/index.php"; - $query = []; - - $msg = new Request($method, $path, $query, $headers); - $msg_buf = Request::marshall($msg); - $msg_copy = Request::unmarshall($msg_buf); - - $this->assertMessagesMatch($msg, $msg_copy); - } - - public function testRequestMarshallingWithQueryParams() { - $headers = [ - "host" => "s3.amazonaws.com", - "test" => "this is a test header value" - ]; - $method = "GET"; - $path = "/index.php"; - $query = [ - 'request' => '1', - 'test' => 'true', - 'answer' => '42', - 'foo' => 'bar', - ]; - - $msg = new Request($method, $path, $query, $headers); - $msg_buf = Request::marshall($msg); - $msg_copy = Request::unmarshall($msg_buf); - - $this->assertMessagesMatch($msg, $msg_copy); - } - - public function testResponseMarshalling() { - $headers = [ - "content-length" => "42", - "test" => "this is a test header value" - ]; - $method = "GET"; - $path = "/index.php"; - $query = [ - 'response' => '1' - ]; - - $msg = new Response($method, $path, $query, $headers, 200); - $msg_buf = Request::marshall($msg); - $msg_copy = Request::unmarshall($msg_buf); - - $this->assertMessagesMatch($msg, $msg_copy); - } -} diff --git a/vendor/aws/aws-crt-php/tests/LogTest.php b/vendor/aws/aws-crt-php/tests/LogTest.php deleted file mode 100644 index 8beff34..0000000 --- a/vendor/aws/aws-crt-php/tests/LogTest.php +++ /dev/null @@ -1,23 +0,0 @@ -assertNotNull($log_stream); - Log::toStream($log_stream); - Log::setLogLevel(Log::TRACE); - Log::log(Log::TRACE, "THIS IS A TEST"); - $this->assertTrue(rewind($log_stream)); - $log_contents = stream_get_contents($log_stream, -1, 0); - $this->assertStringEndsWith("THIS IS A TEST", trim($log_contents)); - Log::stop(); - } -} diff --git a/vendor/aws/aws-crt-php/tests/SigningTest.php b/vendor/aws/aws-crt-php/tests/SigningTest.php deleted file mode 100644 index 77399ab..0000000 --- a/vendor/aws/aws-crt-php/tests/SigningTest.php +++ /dev/null @@ -1,176 +0,0 @@ -assertNotNull($config, "Failed to create default SigningConfigAWS"); - $config = null; - } - - public function testConfigAWSConstructionWithOptions() { - $options = SigningConfigAWS::defaults(); - $options['service'] = 'CRT'; - $options['region'] = 'CRT'; - $config = new SigningConfigAWS($options); - $this->assertNotNull($config, "Failed to create SigningConfigAWS with custom options"); - $config = null; - } - - public function testSignableFromHttpRequestLifetime() { - $request = new Request('GET', '/'); - $signable = Signable::fromHttpRequest($request); - $this->assertNotNull($signable, "Failed to create Signable from HTTP::Request"); - $signable = null; - } - - public function testSignableFromChunkLifetime() { - $chunk = "THIS IS A TEST CHUNK IT CONTAINS MULTITUDES"; - $stream = fopen("php://memory", 'r+'); - fputs($stream, $chunk); - rewind($stream); - $signable = Signable::fromChunk($stream); - $this->assertNotNull($signable, "Failed to create Signable from chunk stream"); - $signable = null; - } - - public function testSignableFromCanonicalRequestLifetime() { - $canonical_request = "THIS IS A CANONICAL_REQUEST. IT IS DEEPLY CANONICAL"; - $signable = Signable::fromCanonicalRequest($canonical_request); - $this->assertNotNull($signable, "Failed to create Signable from canonical request"); - $signable = null; - } - - const SIGV4TEST_ACCESS_KEY_ID = 'AKIDEXAMPLE'; - const SIGV4TEST_SECRET_ACCESS_KEY = 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY'; - const SIGV4TEST_SESSION_TOKEN = null; - const SIGV4TEST_SERVICE = 'service'; - const SIGV4TEST_REGION = 'us-east-1'; - private static function SIGV4TEST_DATE() { - return mktime(12, 36, 0, 8, 30, 2015); - } - - public function testShouldSignHeader() { - $credentials_provider = new StaticCredentialsProvider([ - 'access_key_id' => self::SIGV4TEST_ACCESS_KEY_ID, - 'secret_access_key' => self::SIGV4TEST_SECRET_ACCESS_KEY, - 'session_token' => self::SIGV4TEST_SESSION_TOKEN, - ]); - $signing_config = new SigningConfigAWS([ - 'algorithm' => SigningAlgorithm::SIGv4, - 'signature_type' => SignatureType::HTTP_REQUEST_HEADERS, - 'credentials_provider' => $credentials_provider, - 'region' => self::SIGV4TEST_REGION, - 'service' => self::SIGV4TEST_SERVICE, - 'date' => self::SIGV4TEST_DATE(), - 'should_sign_header' => function($header) { - return strtolower($header) != 'x-do-not-sign'; - } - ]); - $http_request = new Request('GET', '/', [], [ - 'Host' => 'example.amazonaws.com', - 'X-Do-Not-Sign' => 'DO NOT SIGN THIS']); - $this->assertNotNull($http_request, "Unable to create HttpRequest for signing"); - $signable = Signable::fromHttpRequest($http_request); - $this->assertNotNull($signable, "Unable to create signable from HttpRequest"); - - Signing::signRequestAws( - $signable, $signing_config, - function($signing_result, $error_code) use (&$http_request) { - $this->assertEquals(0, $error_code); - $signing_result->applyToHttpRequest($http_request); - } - ); - - // This signature value is computed without the X-Do-Not-Sign header above - $headers = $http_request->headers(); - $this->assertEquals( - 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=5fa00fa31553b73ebf1942676e86291e8372ff2a2260956d9b8aae1d763fbf31', - $headers->get('Authorization')); - } - - public function testSigv4HeaderSigning() { - $credentials_provider = new StaticCredentialsProvider([ - 'access_key_id' => self::SIGV4TEST_ACCESS_KEY_ID, - 'secret_access_key' => self::SIGV4TEST_SECRET_ACCESS_KEY, - 'session_token' => self::SIGV4TEST_SESSION_TOKEN, - ]); - $signing_config = new SigningConfigAWS([ - 'algorithm' => SigningAlgorithm::SIGv4, - 'signature_type' => SignatureType::HTTP_REQUEST_HEADERS, - 'credentials_provider' => $credentials_provider, - 'region' => self::SIGV4TEST_REGION, - 'service' => self::SIGV4TEST_SERVICE, - 'date' => self::SIGV4TEST_DATE(), - ]); - $http_request = new Request('GET', '/', [], ['Host' => 'example.amazonaws.com']); - $this->assertNotNull($http_request, "Unable to create HttpRequest for signing"); - $signable = Signable::fromHttpRequest($http_request); - $this->assertNotNull($signable, "Unable to create signable from HttpRequest"); - - Signing::signRequestAws( - $signable, $signing_config, - function($signing_result, $error_code) use (&$http_request) { - $this->assertEquals(0, $error_code); - $signing_result->applyToHttpRequest($http_request); - } - ); - - $headers = $http_request->headers(); - $this->assertEquals( - 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=5fa00fa31553b73ebf1942676e86291e8372ff2a2260956d9b8aae1d763fbf31', - $headers->get('Authorization')); - $this->assertEquals('20150830T123600Z', $headers->get('X-Amz-Date')); - } - - public function testSigV4aHeaderSigning() { - $credentials_provider = new StaticCredentialsProvider([ - 'access_key_id' => self::SIGV4TEST_ACCESS_KEY_ID, - 'secret_access_key' => self::SIGV4TEST_SECRET_ACCESS_KEY, - 'session_token' => self::SIGV4TEST_SESSION_TOKEN, - ]); - $signing_config = new SigningConfigAWS([ - 'algorithm' => SigningAlgorithm::SIGv4_ASYMMETRIC, - 'signature_type' => SignatureType::HTTP_REQUEST_HEADERS, - 'credentials_provider' => $credentials_provider, - 'region' => self::SIGV4TEST_REGION, - 'service' => self::SIGV4TEST_SERVICE, - 'date' => self::SIGV4TEST_DATE(), - ]); - - $http_request = new Request('GET', '/', [], ['Host' => 'example.amazonaws.com']); - $this->assertNotNull($http_request, "Unable to create HttpRequest for signing"); - $signable = Signable::fromHttpRequest($http_request); - $this->assertNotNull($signable, "Unable to create signable from HttpRequest"); - - Signing::signRequestAws( - $signable, $signing_config, - function($signing_result, $error_code) use (&$http_request) { - $this->assertEquals(0, $error_code); - $signing_result->applyToHttpRequest($http_request); - } - ); - - $headers = $http_request->headers(); - $auth_header_value = $headers->get('Authorization'); - $this->assertNotNull($auth_header_value); - $this->assertStringStartsWith( - 'AWS4-ECDSA-P256-SHA256 Credential=AKIDEXAMPLE/20150830/service/aws4_request, SignedHeaders=host;x-amz-date;x-amz-region-set, Signature=', - $auth_header_value); - $this->assertEquals('20150830T123600Z', $headers->get('X-Amz-Date')); - } -} diff --git a/vendor/aws/aws-crt-php/tests/StreamTest.php b/vendor/aws/aws-crt-php/tests/StreamTest.php deleted file mode 100644 index f8a116a..0000000 --- a/vendor/aws/aws-crt-php/tests/StreamTest.php +++ /dev/null @@ -1,34 +0,0 @@ -getMemoryStream(); - $stream = new InputStream($mem_stream); - $this->assertNotNull($stream, "Failed to create InputStream from PHP memory stream"); - $this->assertEquals(strlen(self::MEM_STREAM_CONTENTS), $stream->length(), "Stream length doesn't match source buffer"); - $this->assertEquals(self::MEM_STREAM_CONTENTS, $stream->read(), "Stream doesn't match source buffer"); - $this->assertTrue($stream->eof(), "Stream is not EOF after reading"); - $this->assertEquals(0, $stream->seek(0, InputStream::SEEK_BEGIN), "Unable to rewind stream"); - $this->assertFalse($stream->eof(), "Stream is EOF after rewinding"); - $this->assertEquals(0, $stream->seek(0, InputStream::SEEK_END), "Unable to seek to end of stream"); - $this->assertTrue($stream->eof(), "Stream is not EOF after seeking to end"); - $stream = null; - } -} diff --git a/vendor/aws/aws-crt-php/tests/common.inc b/vendor/aws/aws-crt-php/tests/common.inc deleted file mode 100644 index 1a7e8f8..0000000 --- a/vendor/aws/aws-crt-php/tests/common.inc +++ /dev/null @@ -1,34 +0,0 @@ -fail("Test left an error on the stack: " . CRT::error_name(CRT::last_error())); - } - } - - // Shim missing calls in older versions of PHPUnit - public function __call($name, $arguments) { - // shim expectException -> setExpectedException for PHPUnit 4.8.x - if ($name == 'expectException') { - $this->setExpectedException($arguments[0]); - } - } -} -- cgit v1.2.3