public function testExceptionThrownWhenNoStatusCode()
 {
     $response = new Response(new \App\Config\AppConfig());
     $this->setExpectedException('BadMethodCallException', 'HTTP Response is missing a status code');
     $response->getStatusCode();
 }
Esempio n. 2
0
 /**
  * Sends the output of this request back to the client.
  * This is what they've been waiting for!
  */
 protected function sendResponse()
 {
     $this->response->setBody($this->output);
     $this->response->send();
 }
Esempio n. 3
0
 public function testRedirectSetsCode()
 {
     $response = new Response(new App());
     try {
         $response->redirect('example.com', 'auto', 307);
         $this->fail('RedirectException should be raised.');
     } catch (RedirectException $e) {
     }
     $this->assertTrue($response->hasHeader('location'));
     $this->assertEquals('example.com', $response->getHeaderLine('Location'));
     $this->assertEquals(307, $response->getStatusCode());
 }