Sep 13, 2017
0
Level 8
Test render() ?
I like to test render() method that located in Handler class (app/exception) without calling $this->get() in the Test file?
I need to make sure that render an exception into an HTTP response working correctly.
public function render($request, Exception $e)
{
$response['exception'] = get_class($e);
$response['message'] = $e->getMessage();
$response['code'] = $e->getCode();
if ($e instanceof SomethingException) {
return $this->errorResponse('lock', $response, 'Lock error has occurred', $e->getCode());
}
return parent::render($request, $e);
}
I like to make sure it has returned into json HTTP response when the condition is if ($e instanceof SomethingException) { }
Please or to participate in this conversation.