@@ -306,14 +306,29 @@ public function testMarshalHostAndPortWillDetectPortInIpv6StyleHost()
306306 $ this ->assertNull ($ uri ->getPort ());
307307 }
308308
309- public function testMarshalUriDetectsHttpsSchemeFromServerValue ()
309+ /**
310+ * @return array
311+ */
312+ public function httpsParamProvider ()
313+ {
314+ return [
315+ 'lowercase ' => ['https ' ],
316+ 'uppercase ' => ['HTTPS ' ],
317+ ];
318+ }
319+
320+ /**
321+ * @dataProvider httpsParamProvider
322+ * @param string $param
323+ */
324+ public function testMarshalUriDetectsHttpsSchemeFromServerValue ($ param )
310325 {
311326 $ request = new ServerRequest ();
312327 $ request = $ request ->withUri (new Uri ('http://example.com/ ' ));
313328 $ request = $ request ->withHeader ('Host ' , 'example.com ' );
314329
315330 $ server = [
316- ' HTTPS ' => true ,
331+ $ param => true ,
317332 ];
318333
319334 $ uri = marshalUriFromSapi ($ server , $ request ->getHeaders ());
@@ -322,14 +337,34 @@ public function testMarshalUriDetectsHttpsSchemeFromServerValue()
322337 $ this ->assertSame ('https ' , $ uri ->getScheme ());
323338 }
324339
325- public function testMarshalUriUsesHttpSchemeIfHttpsServerValueEqualsOff ()
340+ /**
341+ * @return iterable
342+ */
343+ public function httpsDisableParamProvider ()
344+ {
345+ foreach ($ this ->httpsParamProvider () as $ key => $ data ) {
346+ $ param = array_shift ($ data );
347+ foreach (['lowercase-off ' , 'uppercase-off ' ] as $ type ) {
348+ $ key = sprintf ('%s-%s ' , $ key , $ type );
349+ $ value = false !== strpos ($ type , 'lowercase ' ) ? 'off ' : 'OFF ' ;
350+ yield $ key => [$ param , $ value ];
351+ }
352+ }
353+ }
354+
355+ /**
356+ * @dataProvider httpsDisableParamProvider
357+ * @param string $param
358+ * @param string $value
359+ */
360+ public function testMarshalUriUsesHttpSchemeIfHttpsServerValueEqualsOff ($ param , $ value )
326361 {
327362 $ request = new ServerRequest ();
328363 $ request = $ request ->withUri (new Uri ('http://example.com/ ' ));
329364 $ request = $ request ->withHeader ('Host ' , 'example.com ' );
330365
331366 $ server = [
332- ' HTTPS ' => ' off ' ,
367+ $ param => $ value ,
333368 ];
334369
335370 $ uri = marshalUriFromSapi ($ server , $ request ->getHeaders ());
@@ -338,12 +373,16 @@ public function testMarshalUriUsesHttpSchemeIfHttpsServerValueEqualsOff()
338373 $ this ->assertSame ('http ' , $ uri ->getScheme ());
339374 }
340375
341- public function testMarshalUriDetectsHttpsSchemeFromXForwardedProtoValue ()
376+ /**
377+ * @dataProvider httpsParamProvider
378+ * @param string $xForwardedProto
379+ */
380+ public function testMarshalUriDetectsHttpsSchemeFromXForwardedProtoValue ($ xForwardedProto )
342381 {
343382 $ request = new ServerRequest ();
344383 $ request = $ request ->withUri (new Uri ('http://example.com/ ' ));
345384 $ request = $ request ->withHeader ('Host ' , 'example.com ' );
346- $ request = $ request ->withHeader ('X-Forwarded-Proto ' , ' https ' );
385+ $ request = $ request ->withHeader ('X-Forwarded-Proto ' , $ xForwardedProto );
347386
348387 $ server = [];
349388
0 commit comments