update project
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\SchoolCore\Finance;
|
||||
|
||||
use App\Domain\SchoolCore\Finance\Services\BalanceCalculator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class BalanceCalculatorTest extends TestCase
|
||||
{
|
||||
public function test_payment_reduces_balance(): void
|
||||
{
|
||||
$result = (new BalanceCalculator())->calculate(['currency'=>'USD'], [['amount_minor'=>10000,'type'=>'charge']], [['amount_minor'=>4000,'status'=>'recorded']]);
|
||||
$this->assertSame(10000, $result['total_amount_minor']);
|
||||
$this->assertSame(4000, $result['paid_amount_minor']);
|
||||
$this->assertSame(6000, $result['balance_amount_minor']);
|
||||
$this->assertSame('partial', $result['status']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\SchoolCore\Finance;
|
||||
|
||||
use App\Domain\SchoolCore\Finance\Support\Money;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class MoneyTest extends TestCase
|
||||
{
|
||||
public function test_money_adds_and_compares_without_float_math(): void
|
||||
{
|
||||
$a = new Money(12500, 'USD'); $b = new Money(2500, 'USD');
|
||||
$this->assertSame(15000, $a->add($b)->minorAmount());
|
||||
$this->assertSame(10000, $a->subtract($b)->minorAmount());
|
||||
$this->assertSame(1, $a->compare($b));
|
||||
$this->assertSame('125.00', $a->toDecimalString());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user