add: tests

This commit is contained in:
Michael 2024-08-12 15:55:03 +02:00
parent eebf859afa
commit ce7f620984
16 changed files with 681 additions and 152 deletions

View file

@ -1,20 +1,21 @@
<?php
namespace App\Http\Controllers\CsvController\CsvCostCalc;
use function Utils\round_up_to_two_decimals;
class CsvTotalCostCalc
{
private $CsvMinuteCostCalc;
public function __construct()
{
$this->CsvMinuteCostCalc = new CsvMinuteCostCalc();
}
function total_time_cost(array $array, int $total_time)
{
$minute_cost = $this->CsvMinuteCostCalc->select_correct_cost($array['Request By'], $array['Priority']);
$total_cost = $total_time / 60 * $minute_cost;
$total_cost = round_up_to_two_decimals($total_time / 60 * $minute_cost);
$array['Tempo totale'] = gmdate('H:i:s', $total_time);
$array['Costo totale'] = $total_cost;
return $array;