You are here

public function FunctionsTest::testParsesResponseMessages in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/psr7/tests/FunctionsTest.php \GuzzleHttp\Tests\Psr7\FunctionsTest::testParsesResponseMessages()

File

vendor/guzzlehttp/psr7/tests/FunctionsTest.php, line 293

Class

FunctionsTest

Namespace

GuzzleHttp\Tests\Psr7

Code

public function testParsesResponseMessages() {
  $res = "HTTP/1.0 200 OK\r\nFoo: Bar\r\nBaz: Bam\r\nBaz: Qux\r\n\r\nTest";
  $response = Psr7\parse_response($res);
  $this
    ->assertEquals(200, $response
    ->getStatusCode());
  $this
    ->assertEquals('OK', $response
    ->getReasonPhrase());
  $this
    ->assertEquals('1.0', $response
    ->getProtocolVersion());
  $this
    ->assertEquals('Bar', $response
    ->getHeaderLine('Foo'));
  $this
    ->assertEquals('Bam, Qux', $response
    ->getHeaderLine('Baz'));
  $this
    ->assertEquals('Test', (string) $response
    ->getBody());
}