Exemple #1
0
 /**
  * @test
  */
 public function renderSets404Status()
 {
     $templateUrl = \vfsStream::url('testDirectory') . '/template.html';
     file_put_contents($templateUrl, 'template content');
     $this->view->expects($this->once())->method('getTemplatePathAndFilename')->will($this->returnValue($templateUrl));
     $this->view->render();
     $this->assertEquals('404 Not Found', $this->response->getStatus());
 }
Exemple #2
0
 /**
  * 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\FLOW3\Mvc\Exception\UnsupportedRequestTypeException If the request is not a web request
  * @throws \TYPO3\FLOW3\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\FLOW3\Mvc\Exception\StopActionException();
 }
Exemple #3
0
 /**
  * @test
  */
 public function getStatusReturnsTheStatusCodeAndMessage()
 {
     $response = new Response();
     $response->setStatus(418);
     $this->assertEquals('418 Sono Vibiemme', $response->getStatus());
 }