Add assertion to ensure user cannot perform bulk actions on self

This commit is contained in:
Marcus Moore 2024-08-05 16:17:24 -07:00
parent fc405d9d73
commit 5cd9dd4a67
No known key found for this signature in database

View file

@ -48,6 +48,23 @@ class BulkDeleteUsersTest extends TestCase
])->assertSessionHas('error')->assertRedirect();
}
public function testCannotPerformBulkActionsOnSelf()
{
$actor = User::factory()->editUsers()->create();
$this->actingAs($actor)
->post(route('users/bulksave'), [
'ids' => [
$actor->id,
],
'delete_user' => '1',
])
->assertRedirect(route('users.index'))
->assertSessionHas('success', trans('general.bulk_checkin_delete_success'));
$this->assertNotSoftDeleted($actor);
}
public function testAccessoriesCanBeBulkCheckedIn()
{
[$accessoryA, $accessoryB] = Accessory::factory()->count(2)->create();