Aug 21, 2021
0
Level 2
API Testing Override Sanctum default factory behaviour
According to the docs, when testing Sanctum APIs you use the following code to create and login user:
Sanctum::actingAs(
User::factory()->create(),
['view-tasks']
);
In my case am using a different user table from a different Desktop system and I've implemented an API using Sanctum to post data into the system. How can override this to ensure user is created and logged in during test runs?
Please or to participate in this conversation.