I try to use phpunit with Laravel and Spatie but i have a issue.
I have this test :
public function testBasicTest()
{
$user = User::where('id', 2)->first();
$response = $this->actingAs($user, 'api')->json('POST', '/providersList', [
'database' => 'test'
]);
$response->assertStatus(200);
}
But i have a 401 error
Expected status code 200 but received 401. Failed asserting that 200 is identical to 401.
I have this in web.php
Route::group(['middleware' => ['auth:api','role:Admin']], function() {
Route::post('/providersList', 'ProviderController@index');
});