@@ -540,21 +540,40 @@ public function testValidRelativeURI($uri, $isValidRelativeURI)
540
540
{
541
541
$ client = new Client ($ uri );
542
542
$ this ->assertSame ($ isValidRelativeURI , $ client ->getUri ()->isValidRelative ());
543
+
544
+ $ client ->setAdapter (Test::class);
545
+ $ client ->send ();
546
+ $ this ->assertSame ($ isValidRelativeURI , $ client ->getUri ()->isValidRelative ());
543
547
}
544
548
545
- public function testSendRequestWithRelativeURI ()
549
+ public function portChangeDataProvider ()
546
550
{
547
- $ client = new Client ('/example ' );
551
+ return [
552
+ ['https://localhost/example ' , 443 ],
553
+ ['http://localhost/example ' , 80 ]
554
+ ];
555
+ }
556
+
557
+ /**
558
+ * @dataProvider portChangeDataProvider
559
+ */
560
+ public function testAbsoluteSetPort443OnHttps ($ absoluteURI , $ port )
561
+ {
562
+ $ client = new Client ($ absoluteURI );
563
+ $ this ->assertSame ($ port , $ client ->getUri ()->getPort ());
564
+
548
565
$ client ->setAdapter (Test::class);
549
566
$ client ->send ();
550
- $ this ->assertTrue ( $ client ->getUri ()->isValidRelative ());
567
+ $ this ->assertSame ( $ port , $ client ->getUri ()->getPort ());
551
568
}
552
569
553
- public function testSendRequestWithAbsoluteURI ()
570
+ public function testRelativeURIDoesnotSetPort ()
554
571
{
555
- $ client = new Client ('http://localhost/example ' );
572
+ $ client = new Client ('/example ' );
573
+ $ this ->assertSame (null , $ client ->getUri ()->getPort ());
574
+
556
575
$ client ->setAdapter (Test::class);
557
576
$ client ->send ();
558
- $ this ->assertFalse ( $ client ->getUri ()->isValidRelative ());
577
+ $ this ->assertSame ( null , $ client ->getUri ()->getPort ());
559
578
}
560
579
}
0 commit comments