@@ -301,6 +301,7 @@ public static function serverHostnameProvider()
301
301
'REQUEST_URI ' => 'http://test.example.com/news ' ,
302
302
),
303
303
'test.example.com ' ,
304
+ '80 ' ,
304
305
'/news ' ,
305
306
),
306
307
array (
@@ -309,6 +310,30 @@ public static function serverHostnameProvider()
309
310
'REQUEST_URI ' => 'http://test.example.com/news ' ,
310
311
),
311
312
'test.example.com ' ,
313
+ '80 ' ,
314
+ '/news ' ,
315
+ ),
316
+ array (
317
+ array (
318
+ 'SERVER_NAME ' => '[1:2:3:4:5:6::6] ' ,
319
+ 'SERVER_ADDR ' => '1:2:3:4:5:6::6 ' ,
320
+ 'SERVER_PORT ' => '80 ' ,
321
+ 'REQUEST_URI ' => 'http://[1:2:3:4:5:6::6]/news ' ,
322
+ ),
323
+ '[1:2:3:4:5:6::6] ' ,
324
+ '80 ' ,
325
+ '/news ' ,
326
+ ),
327
+ // Test for broken $_SERVER implementation from Windows-Safari
328
+ array (
329
+ array (
330
+ 'SERVER_NAME ' => '[1:2:3:4:5:6:] ' ,
331
+ 'SERVER_ADDR ' => '1:2:3:4:5:6::6 ' ,
332
+ 'SERVER_PORT ' => '6 ' ,
333
+ 'REQUEST_URI ' => 'http://[1:2:3:4:5:6::6]/news ' ,
334
+ ),
335
+ '[1:2:3:4:5:6::6] ' ,
336
+ '80 ' ,
312
337
'/news ' ,
313
338
),
314
339
array (
@@ -318,6 +343,7 @@ public static function serverHostnameProvider()
318
343
'REQUEST_URI ' => 'http://test.example.com/news ' ,
319
344
),
320
345
'test.example.com ' ,
346
+ '8080 ' ,
321
347
'/news ' ,
322
348
),
323
349
array (
@@ -328,6 +354,7 @@ public static function serverHostnameProvider()
328
354
'REQUEST_URI ' => 'https://test.example.com/news ' ,
329
355
),
330
356
'test.example.com ' ,
357
+ '443 ' ,
331
358
'/news ' ,
332
359
),
333
360
);
@@ -339,14 +366,17 @@ public static function serverHostnameProvider()
339
366
* @param string $name
340
367
* @param string $value
341
368
*/
342
- public function testServerHostnameProvider (array $ server , $ expectedHost , $ expectedRequestUri )
369
+ public function testServerHostnameProvider (array $ server , $ expectedHost , $ expectedPort , $ expectedRequestUri )
343
370
{
344
371
$ _SERVER = $ server ;
345
372
$ request = new Request ();
346
373
347
374
$ host = $ request ->getUri ()->getHost ();
348
375
$ this ->assertEquals ($ expectedHost , $ host );
349
376
377
+ $ port = $ request ->getUri ()->getPort ();
378
+ $ this ->assertEquals ($ expectedPort , $ port );
379
+
350
380
$ requestUri = $ request ->getRequestUri ();
351
381
$ this ->assertEquals ($ expectedRequestUri , $ requestUri );
352
382
}
0 commit comments