ax2to's avatar

How to test exception

Hi I'm practicing unit tests with L5.1 and I do know how create a test for this:

/**
     * Render an exception into an HTTP response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Exception  $e
     * @return \Illuminate\Http\Response
     */
    public function render($request, Exception $e)
    {
        if ($e instanceof ModelNotFoundException) {
            $e = new NotFoundHttpException($e->getMessage(), $e);
        }

        return parent::render($request, $e);
    }

I want create a test for IF part.

Can any help me?

Thank you for your time.

0 likes
0 replies

Please or to participate in this conversation.