Skip to content

A free open source IT asset/license management system

Backfill test

Marcus Mooree733d2a5d0d1
diff --git a/tests/Feature/Assets/Ui/ShowAssetTest.php b/tests/Feature/Assets/Ui/ShowAssetTest.php
new file mode 100644
index 0000000000..4410198e67
--- /dev/null
+++ b/tests/Feature/Assets/Ui/ShowAssetTest.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace Tests\Feature\Assets\Ui;
+
+use App\Models\Asset;
+use App\Models\User;
+use Tests\TestCase;
+
+class ShowAssetTest extends TestCase
+{
+ public function testPageForAssetWithMissingModelStillRenders()
+ {
+ $asset = Asset::factory()->create();
+
+ $asset->model_id = null;
+ $asset->forceSave();
+
+ $asset->refresh();
+
+ $this->assertNull($asset->fresh()->model_id, 'This test needs model_id to be null to be helpful.');
+
+ $this->actingAs(User::factory()->superuser()->create())
+ ->get(route('hardware.show', $asset))
+ ->assertOk();
+ }
+}