无法调试Laravel HTTP测试

I have a couple of HTTP tests in a Laravel 5.6 project. I would like to debug the tests and the codepath they call. I can debug the test method but not the actual code. Meaning the debugger doesn't stop at breakpoints in the controller etc.

I'm using Xdebug 2.6.0, PhpStorm 2018.1 and PHP 7.2.

It turns out that the 500 error code came from one of the custom middleware layers and not from the controller. So the breakpoint never got hit because of the error in the middleware layer. I wish that there was an error stack trace instead of only the message "Expected status code 200 but received 500".

I ended up mocking the middleware. Just in case someone is interested how I did it:

$mockMiddleware = Mockery::mock("App\Http\Middleware\MyMiddleware");
$mockMiddleware->shouldReceive("handle")->once()
    ->andReturnUsing(function ($request, $next) {
        return $next($request);
    });

App::instance("App\Http\Middleware\MyMiddleware", $mockMiddleware);