From 2bfef8c030430b162c4e27b44ab5be4af3f197e5 Mon Sep 17 00:00:00 2001 From: Daniel Opitz Date: Fri, 7 Jul 2017 00:04:04 +0200 Subject: [PATCH 1/2] add php-http/psr7-integration-tests --- composer.json | 3 +- tests/Integration/BaseTestFactories.php | 51 +++++++++++++++++++++++++ tests/Integration/ResponseTest.php | 26 +++++++++++++ tests/Integration/ServerRequestTest.php | 27 +++++++++++++ tests/Integration/StreamTest.php | 38 ++++++++++++++++++ tests/Integration/UploadedFileTest.php | 26 +++++++++++++ tests/Integration/UriTest.php | 28 ++++++++++++++ 7 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 tests/Integration/BaseTestFactories.php create mode 100644 tests/Integration/ResponseTest.php create mode 100644 tests/Integration/ServerRequestTest.php create mode 100644 tests/Integration/StreamTest.php create mode 100644 tests/Integration/UploadedFileTest.php create mode 100644 tests/Integration/UriTest.php diff --git a/composer.json b/composer.json index 28606d9..a6df5a1 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,8 @@ }, "require-dev": { "squizlabs/php_codesniffer": "^2.5", - "phpunit/phpunit": "^5.7|^6.0" + "phpunit/phpunit": "^5.7|^6.0", + "php-http/psr7-integration-tests": "dev-master" }, "provide": { "psr/http-message-implementation": "1.0" diff --git a/tests/Integration/BaseTestFactories.php b/tests/Integration/BaseTestFactories.php new file mode 100644 index 0000000..da6cb85 --- /dev/null +++ b/tests/Integration/BaseTestFactories.php @@ -0,0 +1,51 @@ +buildUri('/'), new Headers(), [], $_SERVER, $this->buildStream('')); + } +} diff --git a/tests/Integration/StreamTest.php b/tests/Integration/StreamTest.php new file mode 100644 index 0000000..0de6f4c --- /dev/null +++ b/tests/Integration/StreamTest.php @@ -0,0 +1,38 @@ + Date: Fri, 7 Jul 2017 00:05:40 +0200 Subject: [PATCH 2/2] fix psr-7 issue where host MUST be casted to lower --- src/Uri.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Uri.php b/src/Uri.php index afac69c..9a589af 100644 --- a/src/Uri.php +++ b/src/Uri.php @@ -112,7 +112,7 @@ public function __construct( $password = '' ) { $this->scheme = $this->filterScheme($scheme); - $this->host = $host; + $this->host = strtolower($host); $this->port = $this->filterPort($port); $this->path = empty($path) ? '/' : $this->filterPath($path); $this->query = $this->filterQuery($query); @@ -390,7 +390,7 @@ public function getHost() public function withHost($host) { $clone = clone $this; - $clone->host = $host; + $clone->host = strtolower($host); return $clone; }