In my application, I implemented OAuth2-Server ( oauth2-server-laravel ) in combination with a custom authentication package ( Cartente Sentinel ).
In my .php routes:
Route::group(['before' => 'oauth'], function() {
Therefore, the request must contain an authorization header, or the application terminates with an OAuthException.
Now I want to disable my controllers. Therefore, I have to seed my database with an OAuth session and an access token for each test. Then rewrite the call() method of TestCase and set the HTTP authorization header with a token carrier.
Is there a way to disable or bypass middleware (in my case, only for unit testing)?
In Laravel 4, they were called route filters, and in any case, they were disabled in the test environment. You can also manually enable / disable them using Route::enableFilters() .
nahri source share