mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
adjusting for less than 0 possibility
This commit is contained in:
parent
154e71de74
commit
495521b70e
|
@ -350,6 +350,10 @@ class Helper
|
|||
|
||||
if ($index >= $total_colors) {
|
||||
$index = $index - $total_colors - 1;
|
||||
|
||||
if($index < 0) {
|
||||
$index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return $colors[$index];
|
||||
|
|
21
tests/Feature/DefaultColorKeyTest.php
Normal file
21
tests/Feature/DefaultColorKeyTest.php
Normal file
|
@ -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]);
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@ use PHPUnit\Framework\Assert;
|
|||
use Tests\Support\InteractsWithSettings;
|
||||
use Tests\TestCase;
|
||||
|
||||
|
||||
class CustomReportTest extends TestCase
|
||||
{
|
||||
use InteractsWithSettings;
|
||||
|
|
Loading…
Reference in a new issue