diff options
author | Andrew Dolgov <[email protected]> | 2023-10-20 16:44:35 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2023-10-20 16:44:35 +0300 |
commit | 8bec661288b276c98bdb0e773e5f4d5275dc4c87 (patch) | |
tree | 8617ebe581c62fc46a7881aa61801ebce9d3c603 /vendor/aws/aws-crt-php/tests/HttpMessageTest.php | |
parent | 540438c2eb5452bacad30c247906bfa287f2da1d (diff) |
Diffstat (limited to 'vendor/aws/aws-crt-php/tests/HttpMessageTest.php')
-rw-r--r-- | vendor/aws/aws-crt-php/tests/HttpMessageTest.php | 95 |
1 files changed, 0 insertions, 95 deletions
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 @@ -<?php -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ -use AWS\CRT\HTTP\Headers; -use AWS\CRT\HTTP\Request; -use AWS\CRT\HTTP\Response; - -require_once('common.inc'); - -final class HttpMessageTest extends CrtTestCase { - public function testHeaders() { - $headers = new Headers(); - $this->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); - } -} |