A free open source IT asset/license management system
adjusting for less than 0 possibility
akemidx495521b70ebb
diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.phpindex 98f40de5b8..cd790ff40f 100644--- a/app/Helpers/Helper.php+++ b/app/Helpers/Helper.php@@ -350,6 +350,10 @@ class Helperif ($index >= $total_colors) {$index = $index - $total_colors - 1;++ if($index < 0) {+ $index = 0;+ }}return $colors[$index];diff --git a/tests/Feature/DefaultColorKeyTest.php b/tests/Feature/DefaultColorKeyTest.phpnew file mode 100644index 0000000000..fdabd0db14--- /dev/null+++ b/tests/Feature/DefaultColorKeyTest.php@@ -0,0 +1,21 @@+<?php++namespace Tests\Feature;++use Tests\TestCase;+use App\Models\Statuslabel;+use App\Models\Asset;++class DefaultColorKeyTest extends TestCase+{+ public function DefaultColorKeyTest()+ {+ Statuslabel::factory()->hasAssets(1)->count(255)->create();++ $this->defaultChartColors($index);++ $this->assertArrayHasKey('index', ($index)[0]);+++ }+}diff --git a/tests/Feature/Reports/CustomReportTest.php b/tests/Feature/Reports/CustomReportTest.phpindex a1a269a4ab..dd3199212e 100644--- a/tests/Feature/Reports/CustomReportTest.php+++ b/tests/Feature/Reports/CustomReportTest.php@@ -11,6 +11,7 @@ use PHPUnit\Framework\Assert;use Tests\Support\InteractsWithSettings;use Tests\TestCase;+class CustomReportTest extends TestCase{use InteractsWithSettings;