Vincent's avatar

Access middleware stack in unit test

Is there a way to access the middleware stack of the current request to call disableFor() on the used EncryptCookies middleware instance?

Making app('App\Http\Middleware\EncryptCookies') returns a different object each call.

0 likes
1 reply
Vincent's avatar
Vincent
OP
Best Answer
Level 1
$this->app->resolving(EncryptCookies::class, function ($object) {
    $object->disableFor('cookie-name');
});

Please or to participate in this conversation.