1515use CodeIgniter \Format \FormatterInterface ;
1616use CodeIgniter \Format \JSONFormatter ;
1717use CodeIgniter \Format \XMLFormatter ;
18- use CodeIgniter \HTTP \URI ;
18+ use CodeIgniter \HTTP \SiteURI ;
1919use CodeIgniter \HTTP \UserAgent ;
2020use CodeIgniter \Test \CIUnitTestCase ;
2121use CodeIgniter \Test \Mock \MockIncomingRequest ;
@@ -42,7 +42,7 @@ protected function setUp(): void
4242 $ this ->formatter = new JSONFormatter ();
4343 }
4444
45- protected function makeController (array $ userConfig = [], string $ uri = 'http://example.com ' , array $ userHeaders = [])
45+ protected function makeController (array $ userConfig = [], string $ routePath = '' , array $ userHeaders = [])
4646 {
4747 $ config = new App ();
4848
@@ -73,7 +73,7 @@ protected function makeController(array $userConfig = [], string $uri = 'http://
7373 Factories::injectMock ('config ' , 'Cookie ' , $ cookie );
7474
7575 if ($ this ->request === null ) {
76- $ this ->request = new MockIncomingRequest ($ config , new URI ( $ uri ), null , new UserAgent ());
76+ $ this ->request = new MockIncomingRequest ($ config , new SiteURI ( $ config , $ routePath ), null , new UserAgent ());
7777 $ this ->response = new MockResponse ($ config );
7878 }
7979
@@ -115,7 +115,7 @@ public function resetFormatter(): void
115115 public function testNoFormatterJSON (): void
116116 {
117117 $ this ->formatter = null ;
118- $ controller = $ this ->makeController ([], 'http://codeigniter.com ' , ['Accept ' => 'application/json ' ]);
118+ $ controller = $ this ->makeController ([], '' , ['Accept ' => 'application/json ' ]);
119119
120120 $ this ->invoke ($ controller , 'respondCreated ' , [['id ' => 3 ], 'A Custom Reason ' ]);
121121
@@ -133,7 +133,7 @@ public function testNoFormatterJSON(): void
133133 public function testNoFormatter (): void
134134 {
135135 $ this ->formatter = null ;
136- $ controller = $ this ->makeController ([], 'http://codeigniter.com ' , ['Accept ' => 'application/json ' ]);
136+ $ controller = $ this ->makeController ([], '' , ['Accept ' => 'application/json ' ]);
137137
138138 $ this ->invoke ($ controller , 'respondCreated ' , ['A Custom Reason ' ]);
139139
@@ -484,8 +484,9 @@ private function tryValidContentType($mimeType, $contentType): void
484484 $ original = $ _SERVER ;
485485 $ _SERVER ['CONTENT_TYPE ' ] = $ mimeType ;
486486
487- $ this ->makeController ([], 'http://codeigniter.com ' , ['Accept ' => $ mimeType ]);
487+ $ this ->makeController ([], '' , ['Accept ' => $ mimeType ]);
488488 $ this ->assertSame ($ mimeType , $ this ->request ->getHeaderLine ('Accept ' ), 'Request header... ' );
489+
489490 $ this ->response ->setContentType ($ contentType );
490491 $ this ->assertSame ($ contentType , $ this ->response ->getHeaderLine ('Content-Type ' ), 'Response header pre-response... ' );
491492
@@ -554,7 +555,7 @@ public function testFormatByRequestNegotiateIfFormatIsNotJsonOrXML(): void
554555 }
555556 Factories::injectMock ('config ' , 'Cookie ' , $ cookie );
556557
557- $ request = new MockIncomingRequest ($ config , new URI ($ config-> baseURL ), null , new UserAgent ());
558+ $ request = new MockIncomingRequest ($ config , new SiteURI ($ config ), null , new UserAgent ());
558559 $ response = new MockResponse ($ config );
559560
560561 $ controller = new class ($ request , $ response ) {
0 commit comments