diff --git a/src/HttpBaseTest.php b/src/HttpBaseTest.php index 4d08f6e..e161ed6 100644 --- a/src/HttpBaseTest.php +++ b/src/HttpBaseTest.php @@ -221,7 +221,8 @@ protected function assertResponse($response, array $options = []) $options = array_merge($this->defaultOptions, $options); - $this->assertSame($options['protocolVersion'], $response->getProtocolVersion()); + // The response version may be greater or equal to the request version. See https://tools.ietf.org/html/rfc2145#section-2.3 + $this->assertTrue(substr($options['protocolVersion'], 0, 1) === substr($response->getProtocolVersion(), 0, 1) && 1 !== version_compare($options['protocolVersion'], $response->getProtocolVersion())); $this->assertSame($options['statusCode'], $response->getStatusCode()); $this->assertSame($options['reasonPhrase'], $response->getReasonPhrase()); @@ -253,7 +254,8 @@ protected function assertRequest( ) { $request = $this->getRequest(); - $this->assertSame($protocolVersion, substr($request['SERVER']['SERVER_PROTOCOL'], 5)); + $actualProtocolVersion = substr($request['SERVER']['SERVER_PROTOCOL'], 5); + $this->assertTrue(substr($protocolVersion, 0, 1) === substr($actualProtocolVersion, 0, 1) && 1 !== version_compare($protocolVersion, $actualProtocolVersion)); $this->assertSame($method, $request['SERVER']['REQUEST_METHOD']); $defaultHeaders = [