From 3fda04a8815eee9db82b2400cdd319461dbbce0c Mon Sep 17 00:00:00 2001 From: Husnu Setiawan Date: Fri, 14 Feb 2025 17:57:29 +0700 Subject: [PATCH] fix bug auth login fail --- app/Repositories/Auth/AuthRepository.php | 1 + tests/Feature/Auth/LoginTest.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/app/Repositories/Auth/AuthRepository.php b/app/Repositories/Auth/AuthRepository.php index 45a7ce7..7209983 100644 --- a/app/Repositories/Auth/AuthRepository.php +++ b/app/Repositories/Auth/AuthRepository.php @@ -2,6 +2,7 @@ namespace App\Repositories\Auth; +use Illuminate\Validation\ValidationException; use App\Models\User; use Hash; diff --git a/tests/Feature/Auth/LoginTest.php b/tests/Feature/Auth/LoginTest.php index 4d9b157..d72c492 100644 --- a/tests/Feature/Auth/LoginTest.php +++ b/tests/Feature/Auth/LoginTest.php @@ -26,4 +26,19 @@ class LoginTest extends TestCase $response->assertStatus(200); } + + /** + * A basic feature test example. + */ + public function test_fail(): void + { + $user = User::factory()->create(); + + $response = $this->post('/auth/login',[ + "email" => $user->email, + "password" => "fail", + ]); + + $response->assertStatus(422); + } }