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