@@ -454,14 +454,6 @@ public function testNormalizeFilesReturnsOnlyActualFilesWhenOriginalFilesContain
454
454
$ this ->assertCount (1 , $ normalizedFiles ['fooFiles ' ]);
455
455
}
456
456
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
-
465
457
public function testMarshalProtocolVersionRisesExceptionIfVersionIsNotRecognized ()
466
458
{
467
459
$ method = new ReflectionMethod ('Zend\Diactoros\ServerRequestFactory ' , 'marshalProtocolVersion ' );
@@ -477,4 +469,24 @@ public function testMarshalProtocolReturnsDefaultValueIfHeaderIsNotPresent()
477
469
$ version = $ method ->invoke (null , []);
478
470
$ this ->assertEquals ('1.1 ' , $ version );
479
471
}
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
+ }
480
492
}
0 commit comments