I'm trying to test my authentication routes, but for some reason I can't use a factory to create a user and login. When I use the factory, it returns saying that user does not exist. When I use the Model::create it works fine.
I'm using the same test as one of my other projects, the only difference is that I'm using just username/password instead of email/password like the default Laravel User model. So I'm not really sure if I forgot to set something or it just doesn't want to work for me.
public function test_user_can_login(): void
{
$user = User::factory()->create();
//$user = User::create(['name' => 'test', 'password' => 'password']);
$this->followingRedirects()
->post('/login', [
'name' => $user->name,
'password' => 'password'
]);
$this->assertAuthenticatedAs $user , 'web');
}```