Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
5ac6caf257
3 changed files with 26 additions and 2 deletions
|
@ -61,7 +61,7 @@ class DepreciationReportTransformer
|
|||
/**
|
||||
* Override the previously set null values if there is a valid model and associated depreciation
|
||||
*/
|
||||
if (($asset->model) && ($asset->model->depreciation)) {
|
||||
if (($asset->model) && ($asset->model->depreciation) && ($asset->model->depreciation->months !== 0)) {
|
||||
$depreciated_value = Helper::formatCurrencyOutput($asset->getDepreciatedValue());
|
||||
$monthly_depreciation =Helper::formatCurrencyOutput($asset->purchase_cost / $asset->model->depreciation->months);
|
||||
$diff = Helper::formatCurrencyOutput(($asset->purchase_cost - $asset->getDepreciatedValue()));
|
||||
|
|
|
@ -172,7 +172,7 @@ return [
|
|||
| More info: https://bootstrap-table.com/docs/extensions/cookie/#cookiestorage
|
||||
*/
|
||||
|
||||
'bs_table_storage' => env('BS_TABLE_STORAGE', 'cookieStorage'),
|
||||
'bs_table_storage' => env('BS_TABLE_STORAGE', 'localStorage'),
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue