Skip to content

A free open source IT asset/license management system

Add failing test

Marcus Mooreda8999f59a3c
diff --git a/tests/Unit/Transformers/DepreciationReportTransformerTest.php b/tests/Unit/Transformers/DepreciationReportTransformerTest.php
new file mode 100644
index 0000000000..7a0017196a
--- /dev/null
+++ b/tests/Unit/Transformers/DepreciationReportTransformerTest.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Tests\Unit\Transformers;
+
+use App\Http\Transformers\DepreciationReportTransformer;
+use App\Models\Asset;
+use App\Models\Depreciation;
+use Tests\TestCase;
+
+class DepreciationReportTransformerTest extends TestCase
+{
+ public function testHandlesModelDepreciationMonthsBeingZero()
+ {
+ $asset = Asset::factory()->create();
+ $depreciation = Depreciation::factory()->create(['months' => 0]);
+ $asset->model->depreciation()->associate($depreciation);
+
+ $transformer = new DepreciationReportTransformer;
+
+ $result = $transformer->transformAsset($asset);
+
+ $this->assertIsArray($result);
+ }
+}