CaiWuXiTong/tests/Unit/FinanceLedgerAccountTypeTest.php
shanshi 803764d559 feat: link company plan to public account keep status
Public accounts follow company plan; personal cards remain retained.
2026-12-01 17:13:03 +08:00

39 lines
1.6 KiB
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', ''));
}
public function test_only_public_accounts_follow_company_plan_while_personal_cards_are_always_retained(): void
{
$this->assertTrue(FinanceLedgerAccountType::companyPlanDrivesKeep('公户'));
$this->assertFalse(FinanceLedgerAccountType::companyPlanDrivesKeep('个人卡'));
$this->assertFalse(FinanceLedgerAccountType::companyPlanDrivesKeep('支付宝'));
$this->assertFalse(FinanceLedgerAccountType::companyPlanDrivesKeep('网商银行'));
$this->assertTrue(FinanceLedgerAccountType::isAlwaysRetained('个人卡'));
$this->assertFalse(FinanceLedgerAccountType::isAlwaysRetained('公户'));
}
}