diff --git a/.gitignore b/.gitignore
index 70fc7f9..136dae5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@
vendor
composer.lock
+.phpunit.result.cache
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 9fda4d6..a208fe9 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -14,6 +14,12 @@ and open the template in the editor.
convertDeprecationsToExceptions="true"
stopOnFailure="false">
+
+
+
+
+
+
./src
diff --git a/src/Uri.php b/src/Uri.php
index 406f20d..01525b7 100644
--- a/src/Uri.php
+++ b/src/Uri.php
@@ -237,7 +237,8 @@ public function __construct($uri = null)
$this->port = $this->getFromArray($parsed, 'port');
$this->username = $user;
$this->password = rawurldecode($this->getFromArray($parsed, 'pass'));
- $this->path = preg_replace('~^//~', '', $this->getFromArray($parsed, 'path'));
+ $this->path = preg_replace('~^//~', '', $this->getFromArray($parsed, 'path', ""));
+ $this->path = empty($this->path) ? null : $this->path;
$this->setQuery($this->getFromArray($parsed, 'query', ""));
$this->fragment = $this->getFromArray($parsed, 'fragment');
}
diff --git a/tests/UriTest.php b/tests/UriTest.php
index 6ef8e15..a434770 100644
--- a/tests/UriTest.php
+++ b/tests/UriTest.php
@@ -544,7 +544,7 @@ public function testParsePort($uriStr, $assertFields = null)
public function testParsePath($uriStr, $assertFields = null)
{
$uri = new Uri($uriStr);
- $this->assertEquals($assertFields["Path"], $uri->getPath());
+ $this->assertSame($assertFields["Path"], $uri->getPath());
}
/**