Simplest Test ($this->assertAuthenticatedAs($user);) Failing???
Ok, I feel like I read the entire Google last night ... arrggg!
I cannot get this test to pass nor can I see why. If I comment out $this->assertAuthenticatedAs($user);, it passes.
/** @test */
public function user_can_login_with_proper_credentials (): void
{
$this->withExceptionHandling();
$user = User::factory()->create([
'email' => '[email protected]',
'password' => 'secret',
]);
$this->post('/login', [
'email' => '[email protected]',
'password' => 'secret',
])->assertRedirect('/');
$this->assertAuthenticatedAs($user);
} // end test
The current user is not authenticated.
Failed asserting that null is not null.
/Users/jongravois/code/eight/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithAuthentication.php:89
/Users/jongravois/code/eight/tests/Feature/Auth/AuthenticationTest.php:57