Added test

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2025-02-23 13:17:20 +00:00
parent 50c88df4cc
commit 7b151cf692

View file

@ -40,6 +40,18 @@ class DeleteComponentTest extends TestCase implements TestsFullMultipleCompanies
$this->assertSoftDeleted($component);
}
public function testCannotDeleteComponentIfCheckedOut()
{
$component = Component::factory()->checkedOutToAsset()->create();
$this->actingAs(User::factory()->deleteComponents()->create())
->delete(route('components.destroy', $component->id))
->assertSessionHas('error')
->assertRedirect(route('components.index'));
$this->assertSoftDeleted($component);
}
public function testDeletingComponentRemovesComponentImage()
{
Storage::fake('public');