61 lines
2.3 KiB
PHP
61 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit;
|
|
|
|
use App\Utilities\FinanceLedgerAccountShouldKeep;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class FinanceLedgerAccountShouldKeepTest extends TestCase
|
|
{
|
|
public function test_company_plan_not_retained_defaults_to_temporary_retention(): void
|
|
{
|
|
$this->assertSame(
|
|
FinanceLedgerAccountShouldKeep::TEMPORARY,
|
|
FinanceLedgerAccountShouldKeep::display(null, '不保留'),
|
|
);
|
|
$this->assertSame('暂时保留', FinanceLedgerAccountShouldKeep::label(null, '不保留'));
|
|
}
|
|
|
|
public function test_explicit_not_retained_overrides_company_plan(): void
|
|
{
|
|
$this->assertSame(
|
|
FinanceLedgerAccountShouldKeep::NO,
|
|
FinanceLedgerAccountShouldKeep::display('否', '不保留'),
|
|
);
|
|
$this->assertSame('不保留', FinanceLedgerAccountShouldKeep::label('否', '不保留'));
|
|
}
|
|
|
|
public function test_temporary_retention_remains_a_retained_state(): void
|
|
{
|
|
$this->assertSame(
|
|
FinanceLedgerAccountShouldKeep::TEMPORARY,
|
|
FinanceLedgerAccountShouldKeep::normalize('暂时保留'),
|
|
);
|
|
$this->assertSame('暂时保留', FinanceLedgerAccountShouldKeep::label('暂时保留', '保留'));
|
|
}
|
|
|
|
public function test_company_plan_drives_retained_or_temporarily_retained_value(): void
|
|
{
|
|
$this->assertSame(
|
|
FinanceLedgerAccountShouldKeep::YES,
|
|
FinanceLedgerAccountShouldKeep::fromCompanyPlan('保留'),
|
|
);
|
|
$this->assertSame(
|
|
FinanceLedgerAccountShouldKeep::TEMPORARY,
|
|
FinanceLedgerAccountShouldKeep::fromCompanyPlan('不保留'),
|
|
);
|
|
$this->assertSame(
|
|
FinanceLedgerAccountShouldKeep::TEMPORARY,
|
|
FinanceLedgerAccountShouldKeep::fromCompanyPlan('待注销'),
|
|
);
|
|
$this->assertNull(FinanceLedgerAccountShouldKeep::fromCompanyPlan(''));
|
|
}
|
|
|
|
public function test_company_plan_options_keep_fixed_values_available(): void
|
|
{
|
|
$this->assertContains('保留', FinanceLedgerAccountShouldKeep::companyPlanOptions());
|
|
$this->assertContains('不保留', FinanceLedgerAccountShouldKeep::companyPlanOptions());
|
|
$this->assertContains('待注销', FinanceLedgerAccountShouldKeep::companyPlanOptions());
|
|
}
|
|
}
|