33 lines
1.2 KiB
PHP
33 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit;
|
|
|
|
use App\Enums\Product\ProductBillingCycle;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class ProductBillingCycleLabelTest extends TestCase
|
|
{
|
|
public function test_code_is_translated_to_vietnamese_label(): void
|
|
{
|
|
$this->assertSame('Hàng tháng', ProductBillingCycle::vietnameseLabelFor('monthly'));
|
|
$this->assertSame('6 tháng', ProductBillingCycle::vietnameseLabelFor('semi_annually'));
|
|
$this->assertSame('Hàng năm', ProductBillingCycle::vietnameseLabelFor('annually'));
|
|
}
|
|
|
|
public function test_unknown_or_missing_code_falls_back_safely(): void
|
|
{
|
|
$this->assertSame('custom', ProductBillingCycle::vietnameseLabelFor('custom'));
|
|
$this->assertSame('N/A', ProductBillingCycle::vietnameseLabelFor(null));
|
|
}
|
|
|
|
public function test_months_are_translated_with_fallback(): void
|
|
{
|
|
$this->assertSame('Hàng tháng', ProductBillingCycle::vietnameseLabelForMonths(1));
|
|
$this->assertSame('2 năm', ProductBillingCycle::vietnameseLabelForMonths(24));
|
|
$this->assertSame('9 tháng', ProductBillingCycle::vietnameseLabelForMonths(9));
|
|
$this->assertSame('0 tháng', ProductBillingCycle::vietnameseLabelForMonths(0));
|
|
}
|
|
}
|