コード例 #1
0
 public function testExceptionThrownWhenNoStatusCode()
 {
     $response = new Response(new \App\Config\AppConfig());
     $this->setExpectedException('BadMethodCallException', 'HTTP Response is missing a status code');
     $response->getStatusCode();
 }
コード例 #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();
 }
コード例 #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());
 }