createNotFoundException() protected method

This will result in a 404 response code. Usage example: throw $this->createNotFoundException('Page not found!');
protected createNotFoundException ( string $message = 'Not Found', Exception $previous = null ) : NotFoundHttpException
$message string A message
$previous Exception The previous exception
return Symfony\Component\HttpKernel\Exception\NotFoundHttpException
 public function testCreateNotFoundException()
 {
     $controller = new Controller();
     $this->assertInstanceOf('Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException', $controller->createNotFoundException());
 }
Beispiel #2
0
 public function createNotFoundException($message = 'Not Found', \Exception $previous = null)
 {
     return parent::createNotFoundException($message, $previous);
 }