operationalUser(); $this->postJson('/api/login', [ 'email' => $user->email, 'password' => 'password', ])->assertOk()->assertJsonPath('two_factor', false); $this->assertTrue(Auth::check()); $this->assertSame($user->id, Auth::id()); } public function test_login_fails_with_wrong_password(): void { $user = $this->operationalUser(); $this->postJson('/api/login', [ 'email' => $user->email, 'password' => 'wrong-password', ])->assertUnprocessable(); $this->assertFalse(Auth::check()); } public function test_login_fails_for_disabled_user(): void { $user = $this->operationalUser(['disabled_at' => now()]); $this->postJson('/api/login', [ 'email' => $user->email, 'password' => 'password', ])->assertUnprocessable(); $this->assertFalse(Auth::check()); } }