Example #1
0
 /**
  * @testdox Properly assembles the response to it's string representation.
  * @test
  */
 public function testAssemble()
 {
     $response = new Response(Status::OK);
     $body = 'Ok';
     $len = strlen($body);
     $response->setBody($body);
     $response->setHeader('Content-Type', 'text/html');
     $response->setHeader('Content-Length', $len);
     $expected = "HTTP/1.1 200 Ok\r\nContent-Type: text/html\r\nContent-Length: {$len}\r\n\r\nOk";
     $this->assertEquals($expected, $response->assemble());
     $this->assertEquals($expected, (string) $response);
 }