Update besar apk finance

This commit is contained in:
Wian Drs
2026-09-11 16:03:00 +07:00
parent d42483b350
commit 4ef15c22ae
897 changed files with 98056 additions and 15979 deletions
+47
View File
@@ -0,0 +1,47 @@
<?php
use PHPUnit\Framework\TestCase;
final class FormulaServiceTest extends TestCase
{
private $formula;
protected function setUp(): void
{
$this->formula = new FormulaService();
}
public function testPayrollFormulaHonorsPrecedenceAndVariables(): void
{
$value = $this->formula->calculate('basic_salary + overtime_hours * overtime_rate', array(
'basic_salary' => 5000000,
'overtime_hours' => 4,
'overtime_rate' => 50000,
));
self::assertSame(5200000.0, $value);
}
public function testProrataFormulaAndRounding(): void
{
self::assertSame(333333.33, $this->formula->calculate('salary / work_days', array(
'salary' => 7000000,
'work_days' => 21,
)));
}
public function testUnknownVariableIsZeroForBackwardCompatibleFormula(): void
{
self::assertSame(1000.0, $this->formula->calculate('base + optional_bonus', array('base' => 1000)));
}
public function testRejectsDivisionByZero(): void
{
$this->expectException(BusinessException::class);
$this->formula->calculate('salary / days', array('salary' => 1000, 'days' => 0));
}
public function testRejectsUnsafeTokens(): void
{
$this->expectException(BusinessException::class);
$this->formula->calculate('system("whoami")', array());
}
}