Skip to content

Commit

Permalink
Merge c14a3be into 0dca983
Browse files Browse the repository at this point in the history
  • Loading branch information
Stilch committed May 9, 2021
2 parents 0dca983 + c14a3be commit 1c372ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Uri.php
Expand Up @@ -149,7 +149,7 @@ protected function filterScheme($scheme): string
}

$scheme = str_replace('://', '', strtolower($scheme));
if (!key_exists($scheme, self::SUPPORTED_SCHEMES)) {
if (!key_exists($scheme, static::SUPPORTED_SCHEMES)) {
throw new InvalidArgumentException(
'Uri scheme must be one of: "' . implode('", "', array_keys(static::SUPPORTED_SCHEMES)) . '"'
);
Expand Down
12 changes: 12 additions & 0 deletions tests/UriTest.php
Expand Up @@ -31,6 +31,18 @@ public function uriFactory()
return new Uri($scheme, $host, $port, $path, $query, $fragment, $user, $password);
}

public function testSupportOtherSchemes()
{
$wsUri = new class ('ws', 'example.com') extends Uri {
public const SUPPORTED_SCHEMES = [
'ws' => 80,
'wss' => 443,
];
};

$this->assertEquals('ws', $wsUri->getScheme());
}

public function testGetScheme()
{
$this->assertEquals('https', $this->uriFactory()->getScheme());
Expand Down

0 comments on commit 1c372ff

Please sign in to comment.