11<?php
22namespace Gt \Http \Test ;
33
4- use Gt \Http \PortOutOfBoundsException ;
54use Gt \Http \Uri ;
65use Gt \Http \UriFactory ;
76use PHPUnit \Framework \TestCase ;
8- use Psr \Http \Message \UriInterface ;
97
108class UriTest extends TestCase {
119 public function testParsesProvidedUri () {
@@ -547,11 +545,9 @@ public function testRelativePathAndAuhorityIsAutomagicallyFixed() {
547545 $ this ->assertSame ('//example.com/foo ' , (string )$ uri );
548546 }
549547
550- /**
551- * @expectedException \InvalidArgumentException
552- * @expectedExceptionMessage The path of a URI without an authority must not start with two slashes "//"
553- */
554548 public function testPathStartingWithTwoSlashesAndNoAuthorityIsInvalid () {
549+ self ::expectException (\InvalidArgumentException::class);
550+ self ::expectExceptionMessage ("The path of a URI without an authority must not start with two slashes \"// \"" );
555551 // URI "//foo" would be interpreted as network reference and thus change the original path to the host
556552 (new Uri )->withPath ('//foo ' );
557553 }
@@ -561,22 +557,20 @@ public function testPathStartingWithTwoSlashes() {
561557 $ this ->assertSame ('//path-not-host.com ' , $ uri ->getPath ());
562558 $ uri = $ uri ->withScheme ('' );
563559 $ this ->assertSame ('//example.org//path-not-host.com ' , (string )$ uri ); // This is still valid
564- self ::expectException (' \InvalidArgumentException ' );
560+ self ::expectException (\InvalidArgumentException::class );
565561 $ uri ->withHost ('' ); // Now it becomes invalid
566562 }
567563
568- /**
569- * @expectedException \InvalidArgumentException
570- * @expectedExceptionMessage A relative URI must not have a path beginning with a segment containing a colon
571- */
572564 public function testRelativeUriWithPathBeginngWithColonSegmentIsInvalid () {
565+ self ::expectException (\InvalidArgumentException::class);
566+ self ::expectExceptionMessage ("A relative URI must not have a path beginning with a segment containing a colon " );
573567 (new Uri )->withPath ('mailto:foo ' );
574568 }
575569
576570 public function testRelativeUriWithPathHavingColonSegment () {
577571 $ uri = (new Uri ('urn:/mailto:foo ' ))->withScheme ('' );
578572 $ this ->assertSame ('/mailto:foo ' , $ uri ->getPath ());
579- self ::expectException (' \InvalidArgumentException ' );
573+ self ::expectException (\InvalidArgumentException::class );
580574 (new Uri ('urn:mailto:foo ' ))->withScheme ('' );
581575 }
582576
0 commit comments