X-Strike's avatar

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) { }

0 likes
0 replies

Please or to participate in this conversation.