-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4382adc
commit 49136a4
Showing
3 changed files
with
27 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,10 +73,14 @@ public static function formatCurrencyOutput($cost) | |
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @since [v3.3] | ||
* @return array | ||
* @return string | ||
*/ | ||
public static function defaultChartColors($index = 0) | ||
public static function defaultChartColors(int $index = 0) | ||
{ | ||
if ($index < 0) { | ||
$index = 0; | ||
} | ||
|
||
$colors = [ | ||
'#008941', | ||
'#FF4A46', | ||
|
@@ -359,8 +363,8 @@ public static function defaultChartColors($index = 0) | |
if($index < 0) { | ||
$index = 0; | ||
} | ||
elseif($index > 265) { | ||
$index = 265; | ||
elseif($index >($total_colors - 1)) { | ||
$index = $total_colors - 1; | ||
} | ||
} | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Tests\Unit\Helpers; | ||
|
||
use App\Helpers\Helper; | ||
use Tests\TestCase; | ||
|
||
class HelperTest extends TestCase | ||
{ | ||
public function testDefaultChartColorsMethodHandlesHighValues() | ||
{ | ||
$this->assertIsString(Helper::defaultChartColors(1000)); | ||
} | ||
|
||
public function testDefaultChartColorsMethodHandlesNegativeNumbers() | ||
{ | ||
$this->assertIsString(Helper::defaultChartColors(-1)); | ||
} | ||
} |