Fixed tests

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-06-05 14:50:45 +01:00
parent 374c6845d6
commit 7ac315e1eb
2 changed files with 11 additions and 1 deletions

View file

@ -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.
*/

View file

@ -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());