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/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; } 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 @@ +