Files
2026-08-25 05:33:01 +08:00

21 lines
802 B
PHP

<?php
use AKSRT\Ledger\AssetType;
use AKSRT\Ledger\LedgerResult;
use PHPUnit\Framework\TestCase;
final class LedgerResultTest extends TestCase {
public function test_balance_reads_integer_minor_units(): void {
$result = new LedgerResult(17, true, [], [
4 => ['points' => 25, 'balance' => 1234],
], 'AK20260825123456000001');
self::assertSame(25, $result->balance(4, AssetType::POINTS));
self::assertSame(1234, $result->balance(4, AssetType::BALANCE));
self::assertSame(0, $result->balance(99, AssetType::BALANCE));
self::assertSame(17, $result->to_array()['transaction_id']);
self::assertTrue($result->to_array()['replayed']);
self::assertSame('AK20260825123456000001', $result->flow_number);
self::assertSame('AK20260825123456000001', $result->to_array()['flow_number']);
}
}