From 06737f45ad64c2a0349465f927bcd49535eb2c07 Mon Sep 17 00:00:00 2001 From: snipe Date: Sat, 22 Jun 2024 18:36:02 +0100 Subject: [PATCH] Added test Signed-off-by: snipe --- tests/Feature/Users/Ui/DeleteUserTest.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/Feature/Users/Ui/DeleteUserTest.php b/tests/Feature/Users/Ui/DeleteUserTest.php index 5679bb3ac1..1fde5d9558 100644 --- a/tests/Feature/Users/Ui/DeleteUserTest.php +++ b/tests/Feature/Users/Ui/DeleteUserTest.php @@ -34,7 +34,18 @@ class DeleteUserTest extends TestCase ->delete(route('users.destroy', ['user' => '40596803548609346'])) ->assertStatus(302) ->assertRedirect(route('users.index')); - //$this->followRedirects($response)->assertSee(trans('general.error')); + $this->followRedirects($response)->assertSee(trans('alert-danger')); + } + + public function testErrorReturnedIfUserIsAlreadyDeleted() + { + $user = User::factory()->deletedUser()->viewUsers()->create(); + $response = $this->actingAs(User::factory()->deleteUsers()->viewUsers()->create()) + ->delete(route('users.destroy', $user->id)) + ->assertStatus(302) + ->assertRedirect(route('users.index')); + + $this->followRedirects($response)->assertSee(trans('general.error')); }