CaiWuXiTong/tests/Unit/FinanceLedgerAccountTypeTest.php

28 lines
952 B
PHP

<?php
namespace Tests\Unit;
use App\Utilities\FinanceLedgerAccountType;
use PHPUnit\Framework\TestCase;
class FinanceLedgerAccountTypeTest extends TestCase
{
public function test_bank_account_types_use_the_last_four_digits_of_the_account_number(): void
{
foreach (FinanceLedgerAccountType::BANK_ACCOUNT_TYPES as $type) {
$this->assertSame('5678', FinanceLedgerAccountType::last4($type, '6222-1234 5678', '0000'));
}
}
public function test_alipay_always_uses_a_slash(): void
{
$this->assertSame('/', FinanceLedgerAccountType::last4('支付宝', 'alipay@example.com', '1234'));
}
public function test_other_types_keep_the_fallback_when_no_bank_last_four_can_be_derived(): void
{
$this->assertSame('1234', FinanceLedgerAccountType::last4('其他', 'alipay@example.com', '1234'));
$this->assertSame('/', FinanceLedgerAccountType::last4('公户', '123', ''));
}
}