File tree 2 files changed +25
-1
lines changed
2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ protected function normaliseBaseUri(string $baseUri):Uri {
13
13
$ host = parse_url ($ baseUri , PHP_URL_HOST )
14
14
?? parse_url ($ baseUri , PHP_URL_PATH );
15
15
$ port = parse_url ($ baseUri , PHP_URL_PORT )
16
- ?? 80 ;
16
+ ?? null ;
17
17
18
18
$ uri = (new Uri ())
19
19
->withScheme ($ scheme )
Original file line number Diff line number Diff line change @@ -24,6 +24,30 @@ public function testAuthUriHttps() {
24
24
"https " ,
25
25
$ sut ->getScheme ()
26
26
);
27
+ self ::assertNull (
28
+ $ sut ->getPort ()
29
+ );
30
+ }
31
+
32
+ public function testAuthUriWithNonStandardPort () {
33
+ $ baseUri = self ::createMock (UriInterface::class);
34
+ $ baseUri ->method ("__toString " )
35
+ ->willReturn ("http://localhost:8081 " );
36
+ $ token = self ::createMock (Token::class);
37
+
38
+ $ sut = new AuthUri (
39
+ $ token ,
40
+ "" ,
41
+ $ baseUri
42
+ );
43
+ self ::assertEquals (
44
+ "http " ,
45
+ $ sut ->getScheme ()
46
+ );
47
+ self ::assertEquals (
48
+ 8081 ,
49
+ $ sut ->getPort ()
50
+ );
27
51
}
28
52
29
53
// All AuthUris MUST be served over HTTPS, with the one exception of localhost.
You can’t perform that action at this time.
0 commit comments