@@ -454,14 +454,6 @@ public function testNormalizeFilesReturnsOnlyActualFilesWhenOriginalFilesContain
454454 $ this ->assertCount (1 , $ normalizedFiles ['fooFiles ' ]);
455455 }
456456
457- public function testMarshalProtocolVersionReturnsHttpVersion ()
458- {
459- $ method = new ReflectionMethod ('Zend\Diactoros\ServerRequestFactory ' , 'marshalProtocolVersion ' );
460- $ method ->setAccessible (true );
461- $ version = $ method ->invoke (null , ['SERVER_PROTOCOL ' => 'HTTP/1.0 ' ]);
462- $ this ->assertEquals ('1.0 ' , $ version );
463- }
464-
465457 public function testMarshalProtocolVersionRisesExceptionIfVersionIsNotRecognized ()
466458 {
467459 $ method = new ReflectionMethod ('Zend\Diactoros\ServerRequestFactory ' , 'marshalProtocolVersion ' );
@@ -477,4 +469,24 @@ public function testMarshalProtocolReturnsDefaultValueIfHeaderIsNotPresent()
477469 $ version = $ method ->invoke (null , []);
478470 $ this ->assertEquals ('1.1 ' , $ version );
479471 }
472+
473+ /**
474+ * @dataProvider marshalProtocolVersionProvider
475+ */
476+ public function testMarshalProtocolVersionReturnsHttpVersions ($ protocol , $ expected )
477+ {
478+ $ method = new ReflectionMethod ('Zend\Diactoros\ServerRequestFactory ' , 'marshalProtocolVersion ' );
479+ $ method ->setAccessible (true );
480+ $ version = $ method ->invoke (null , ['SERVER_PROTOCOL ' => $ protocol ]);
481+ $ this ->assertEquals ($ expected , $ version );
482+ }
483+
484+ public function marshalProtocolVersionProvider ()
485+ {
486+ return [
487+ 'HTTP/1.0 ' => ['HTTP/1.0 ' , '1.0 ' ],
488+ 'HTTP/1.1 ' => ['HTTP/1.1 ' , '1.1 ' ],
489+ 'HTTP/2 ' => ['HTTP/2 ' , '2 ' ],
490+ ];
491+ }
480492}
0 commit comments