|
10 | 10 | namespace ZendTest\Diactoros; |
11 | 11 |
|
12 | 12 | use PHPUnit_Framework_TestCase as TestCase; |
| 13 | +use ReflectionMethod; |
13 | 14 | use ReflectionProperty; |
14 | 15 | use UnexpectedValueException; |
15 | 16 | use Zend\Diactoros\ServerRequest; |
@@ -439,19 +440,25 @@ public function testNormalizeFilesReturnsOnlyActualFilesWhenOriginalFilesContain |
439 | 440 |
|
440 | 441 | public function testMarshalProtocolVersionReturnsHttpVersion() |
441 | 442 | { |
442 | | - $version = ServerRequestFactory::marshalProtocolVersion(['SERVER_PROTOCOL' => 'HTTP/1.0']); |
| 443 | + $method = new ReflectionMethod(ServerRequestFactory::class, 'marshalProtocolVersion'); |
| 444 | + $method->setAccessible(true); |
| 445 | + $version = $method->invoke(null, ['SERVER_PROTOCOL' => 'HTTP/1.0']); |
443 | 446 | $this->assertEquals('1.0', $version); |
444 | 447 | } |
445 | 448 |
|
446 | 449 | public function testMarshalProtocolVersionRisesExceptionIfVersionIsNotRecognized() |
447 | 450 | { |
| 451 | + $method = new ReflectionMethod(ServerRequestFactory::class, 'marshalProtocolVersion'); |
| 452 | + $method->setAccessible(true); |
448 | 453 | $this->setExpectedException('UnexpectedValueException'); |
449 | | - ServerRequestFactory::marshalProtocolVersion(['SERVER_PROTOCOL' => 'dadsa/1.0']); |
| 454 | + $method->invoke(null, ['SERVER_PROTOCOL' => 'dadsa/1.0']); |
450 | 455 | } |
451 | 456 |
|
452 | 457 | public function testMarshalProtocolReturnsDefaultValueIfHeaderIsNotPresent() |
453 | 458 | { |
454 | | - $version = ServerRequestFactory::marshalProtocolVersion([]); |
| 459 | + $method = new ReflectionMethod(ServerRequestFactory::class, 'marshalProtocolVersion'); |
| 460 | + $method->setAccessible(true); |
| 461 | + $version = $method->invoke(null, []); |
455 | 462 | $this->assertEquals('1.1', $version); |
456 | 463 | } |
457 | 464 | } |
0 commit comments