Skip to content

Commit

Permalink
Merge pull request #12 from byjg/deprecation-warning
Browse files Browse the repository at this point in the history
Fix unittest to get deprecation warnings
  • Loading branch information
byjg authored Apr 27, 2022
2 parents c32b436 + 4eacf44 commit 2e5a2e4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

vendor
composer.lock
.phpunit.result.cache
6 changes: 6 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ and open the template in the editor.
convertDeprecationsToExceptions="true"
stopOnFailure="false">

<php>
<ini name="display_errors" value="On" />
<ini name="display_startup_errors" value="On" />
<ini name="error_reporting" value="E_ALL" />
</php>

<filter>
<whitelist>
<directory>./src</directory>
Expand Down
3 changes: 2 additions & 1 deletion src/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
2 changes: 1 addition & 1 deletion tests/UriTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

/**
Expand Down

0 comments on commit 2e5a2e4

Please sign in to comment.