A forbidden should throw a 403 and this makes it easier for me to do some automated testing.
* @return TemplateResponse
*/
public function afterException($controller, $methodName, \Exception $exception) {
- return new TemplateResponse('core', '403', array(), 'guest');
+ $response = new TemplateResponse('core', '403', array(), 'guest');
+ $response->setStatus(Http::STATUS_FORBIDDEN);
+ return $response;
}
}
$this->subadminMiddlewareAsSubAdmin->beforeController($this->controller, 'foo');
}
-
-
-
public function testAfterException() {
$expectedResponse = new TemplateResponse('core', '403', array(), 'guest');
+ $expectedResponse->setStatus(403);
$this->assertEquals($expectedResponse, $this->subadminMiddleware->afterException($this->controller, 'foo', new \Exception()));
}
-}
\ No newline at end of file
+}