laravel-swagger-api icon indicating copy to clipboard operation
laravel-swagger-api copied to clipboard

Breaks tests

Open stebogit opened this issue 3 years ago • 1 comments

Hey, I'm using the Api class in my routes/api.php file, but that broke my tests as if no routes were defined, e.g.

Symfony\Component\Routing\Exception\RouteNotFoundException : Route [api.weather.daily] not defined.

I tried building the Api resources before or after the Route:: definitions, but the result is the same; I have to skip the swagger stuff if the tests are running

if (!app()->environment('testing')) {
    Api::get('/some', [ApiController::class, 'some']);
    ...
}

Any clue?

Using version 1.4.0 on Laravel 9.x.

stebogit avatar Oct 10 '22 23:10 stebogit

Actually, after further playing around with it it seems the Api definitions actually break the Auth pattern, that is the Sanctum guard is skipped entirely.

stebogit avatar Oct 11 '22 00:10 stebogit