refreshApplicationWithLocale('en'); $this->user = User::factory()->create(); } public function test_login_success() { $response = $this ->actingAs($this->user) ->postJson('/api/login', [ 'email' => $this->user->email, 'password' => 'password', ]); // Assert a token was returned $response->assertStatus(200); $response->assertJsonStructure(['token']); } public function test_login_failed_no_register_user() { $user = User::factory()->make(); $response = $this ->postJson('/api/login', [ 'email' => $user->email, 'password' => 'password', ]); // Assert a token was returned $response->assertStatus(401); } public function test_login_failed_error_password() { $response = $this ->actingAs($this->user) ->postJson('/api/login', [ 'email' => $this->user->email, 'password' => '1234567890', ]); // Assert a token was returned $response->assertStatus(401); } }