Skip to content

A free open source IT asset/license management system

Added test

snipe7b151cf6920e
diff --git a/tests/Feature/Components/Ui/DeleteComponentTest.php b/tests/Feature/Components/Ui/DeleteComponentTest.php
index a0b8131532..56950cab7b 100644
--- a/tests/Feature/Components/Ui/DeleteComponentTest.php
+++ b/tests/Feature/Components/Ui/DeleteComponentTest.php
@@ -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');