diff --git a/app/Http/Requests/DeleteUserRequest.php b/app/Http/Requests/DeleteUserRequest.php index a640d6a9d2..8136bd68e2 100644 --- a/app/Http/Requests/DeleteUserRequest.php +++ b/app/Http/Requests/DeleteUserRequest.php @@ -11,6 +11,9 @@ use Illuminate\Http\Request; class DeleteUserRequest extends FormRequest { + + protected $redirectRoute = 'users.index'; + /** * Determine if the user is authorized to make this request. */ diff --git a/tests/Feature/Users/Ui/DeleteUserTest.php b/tests/Feature/Users/Ui/DeleteUserTest.php index 137a498d66..0f5fbdcec7 100644 --- a/tests/Feature/Users/Ui/DeleteUserTest.php +++ b/tests/Feature/Users/Ui/DeleteUserTest.php @@ -99,7 +99,14 @@ class DeleteUserTest extends TestCase public function testDisallowUserDeletionIfTheyStillHaveAssets() { $user = User::factory()->create(); - Asset::factory()->count(6)->checkedOutToUser($user)->create(); + $asset = Asset::factory()->create(); + + $this->actingAs(User::factory()->checkoutAssets()->create()) + ->post(route('hardware.checkout.store', $asset->id), [ + 'checkout_to_type' => 'user', + 'assigned_user' => $user->id, + 'name' => 'Changed Name', + ]); $this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())->assertFalse($user->isDeletable());