/** * Sends the specified HTTP status immediately. * * NOTE: This method only supports web requests and will throw an exception if used with other request types. * * @param integer $statusCode The HTTP status code * @param string $statusMessage A custom HTTP status message * @param string $content Body content which further explains the status * @throws \TYPO3\Flow\Mvc\Exception\UnsupportedRequestTypeException If the request is not a web request * @throws \TYPO3\Flow\Mvc\Exception\StopActionException * @api */ protected function throwStatus($statusCode, $statusMessage = null, $content = null) { $this->response->setStatus($statusCode, $statusMessage); if ($content === null) { $content = $this->response->getStatus(); } $this->response->setContent($content); throw new \TYPO3\Flow\Mvc\Exception\StopActionException(); }
/** * @test */ public function getStatusReturnsTheStatusCodeAndMessage() { $response = new Response(); $response->setStatus(418); $this->assertEquals('418 Sono Vibiemme', $response->getStatus()); }