Skip to content

A free open source IT asset/license management system

Add failing test

Marcus Moorea060dde6258d
diff --git a/tests/Feature/Checkins/General/CheckinTest.php b/tests/Feature/Checkins/General/CheckinTest.php
new file mode 100644
index 0000000000..1ae2c1a597
--- /dev/null
+++ b/tests/Feature/Checkins/General/CheckinTest.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Tests\Feature\Checkins\General;
+
+use App\Models\Accessory;
+use App\Models\User;
+use Tests\TestCase;
+
+class CheckinTest extends TestCase
+{
+ public function test_gracefully_handles_category_being_soft_deleted()
+ {
+ $this->withoutExceptionHandling();
+
+ $accessory = Accessory::factory()->checkedOutToUser()->create();
+
+ $accessory->category->delete();
+
+ $this->actingAs(User::factory()->checkinAccessories()->create())
+ ->post(route('accessories.checkin.store', $accessory->checkouts->first()->id));
+
+ $this->assertEquals(0, $accessory->fresh()->checkouts->count());
+ }
+}