diff --git a/tests/Feature/Users/Ui/BulkDeleteUsersTest.php b/tests/Feature/Users/Ui/BulkDeleteUsersTest.php index cf283ad4c6..01e16d5022 100644 --- a/tests/Feature/Users/Ui/BulkDeleteUsersTest.php +++ b/tests/Feature/Users/Ui/BulkDeleteUsersTest.php @@ -3,6 +3,7 @@ namespace Tests\Feature\Users\Ui; use App\Models\Accessory; +use App\Models\Asset; use App\Models\Consumable; use App\Models\Statuslabel; use App\Models\User; @@ -23,6 +24,31 @@ class BulkDeleteUsersTest extends TestCase ->assertForbidden(); } + public function testValidation() + { + // $this->markTestIncomplete(); + $user = User::factory()->create(); + Asset::factory()->assignedToUser($user)->create(); + + $actor = $this->actingAs(User::factory()->editUsers()->create()); + + // "ids" required + $actor->post(route('users/bulksave'), [ + // 'ids' => [ + // $user->id, + // ], + 'status_id' => Statuslabel::factory()->create()->id, + ])->assertSessionHas('error')->assertRedirect(); + + // "status_id" needed when provided users have assets associated + $actor->post(route('users/bulksave'), [ + 'ids' => [ + $user->id, + ], + // 'status_id' => Statuslabel::factory()->create()->id, + ])->assertSessionHas('error')->assertRedirect(); + } + public function testAccessoryCheckinsAreProperlyLogged() { [$accessoryA, $accessoryB] = Accessory::factory()->count(2)->create();