fix: env vars handled via conf file, add: functional tests
This commit is contained in:
parent
3d08b14f11
commit
21c4330f16
39 changed files with 416 additions and 172 deletions
|
@ -12,8 +12,8 @@ class CsvAgentCost
|
|||
|
||||
public function __construct()
|
||||
{
|
||||
$this->internal_percentage_to_deduct = (float) getenv('PRICE_INTERNAL_PERCENTAGE_TO_DEDUCT', null);
|
||||
$this->partner_organitation = strtolower(getenv('GITEA_PARTNER_ORGANIZATION'));
|
||||
$this->internal_percentage_to_deduct = (float) config('app.price_internal_percentage_to_deduct', null);
|
||||
$this->partner_organitation = strtolower(config('app.gitea_partner_organization'));
|
||||
$this->CsvMinuteCostCalc = new CsvMinuteCostCalc();
|
||||
}
|
||||
|
||||
|
|
|
@ -8,13 +8,13 @@ class CsvCostCalc
|
|||
* @var CsvMinuteCostCalc|(CsvMinuteCostCalc&object&\PHPUnit\Framework\MockObject\MockObject)|(CsvMinuteCostCalc&\PHPUnit\Framework\MockObject\MockObject)|(object&\PHPUnit\Framework\MockObject\MockObject)|\PHPUnit\Framework\MockObject\MockObject
|
||||
*/
|
||||
|
||||
public function __construct()
|
||||
public function __construct($calculate_agent_cost = false)
|
||||
{
|
||||
$this->internal_percentage_to_deduct = getenv('PRICE_INTERNAL_PERCENTAGE_TO_DEDUCT');
|
||||
$this->partner_organitation = strtolower(getenv('GITEA_PARTNER_ORGANIZATION'));
|
||||
$this->internal_percentage_to_deduct = config('app.price_internal_percentage_to_deduct');
|
||||
$this->partner_organitation = strtolower(config('app.gitea_partner_organization'));
|
||||
$this->CsvAgentCost = new CsvAgentCost();
|
||||
$this->CsvTotalCostCalc = new CsvTotalCostCalc();
|
||||
$this->CsvSumTotalsCalc = new CsvSumTotalsCalc();
|
||||
$this->CsvSumTotalsCalc = new CsvSumTotalsCalc($calculate_agent_cost);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -10,18 +10,18 @@ class CsvMinuteCostCalc
|
|||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->internal_percentage_to_deduct = getenv('PRICE_INTERNAL_PERCENTAGE_TO_DEDUCT');
|
||||
$this->partner_organization = strtolower(getenv('GITEA_PARTNER_ORGANIZATION'));
|
||||
$this->internal_percentage_to_deduct = config('app.price_internal_percentage_to_deduct');
|
||||
$this->partner_organization = strtolower(config('app.gitea_partner_organization'));
|
||||
$this->price_partner = [
|
||||
'high' => $this->calculate_minute_cost((int)getenv('PRICE_PARTNER_HIGH')),
|
||||
'normal' => $this->calculate_minute_cost((int)getenv('PRICE_PARTNER_NORMAL')),
|
||||
'low' => $this->calculate_minute_cost((int)getenv('PRICE_PARTNER_LOW')),
|
||||
'high' => $this->calculate_minute_cost((int)config('app.price_partner_high')),
|
||||
'normal' => $this->calculate_minute_cost((int)config('app.price_partner_normal')),
|
||||
'low' => $this->calculate_minute_cost((int)config('app.price_partner_low')),
|
||||
'0'=>0,
|
||||
];
|
||||
$this->price_client = [
|
||||
'high' => $this->calculate_minute_cost((int)getenv('PRICE_CLIENT_HIGH')),
|
||||
'normal' => $this->calculate_minute_cost((int)getenv('PRICE_CLIENT_NORMAL')),
|
||||
'low' => $this->calculate_minute_cost((int)getenv('PRICE_CLIENT_LOW')),
|
||||
'high' => $this->calculate_minute_cost((int)config('app.price_client_high')),
|
||||
'normal' => $this->calculate_minute_cost((int)config('app.price_client_normal')),
|
||||
'low' => $this->calculate_minute_cost((int)config('app.price_client_low')),
|
||||
'0'=>0,
|
||||
];
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@ class CsvSumTotalsCalc
|
|||
|
||||
private $calculate_agent_cost;
|
||||
|
||||
public function __construct()
|
||||
public function __construct($calculate_agent_cost = false)
|
||||
{
|
||||
$this->calculate_agent_cost = env('GITEA_CALCULATE_AGENT_COST');
|
||||
$this->calculate_agent_cost = $calculate_agent_cost || config('app.gitea_calculate_agent_cost');
|
||||
}
|
||||
|
||||
private function sum_total_cost(array $array)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue