Files
wordpress-theme-aksrt/tests/asset-ledger/LedgerResultTest.php
T

19 lines
626 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],
]);
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']);
}
}