34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit;
|
|
|
|
use App\Enums\CaseLabelBit;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class CaseLabelBitTest extends TestCase
|
|
{
|
|
public function test_split_returns_each_set_bit(): void
|
|
{
|
|
$this->assertSame([], CaseLabelBit::split(0));
|
|
$this->assertSame([2], CaseLabelBit::split(2));
|
|
$this->assertSame([2, 4], CaseLabelBit::split(6));
|
|
$this->assertSame([1, 2, 4, 8], CaseLabelBit::split(15));
|
|
}
|
|
|
|
public function test_to_text_describes_stuck_reasons(): void
|
|
{
|
|
$this->assertSame('无标记', CaseLabelBit::toText(0));
|
|
$this->assertSame('新病例订单卡生产', CaseLabelBit::toText(CaseLabelBit::APPLIANCE_NEED_MONEY));
|
|
$this->assertSame(
|
|
'新病例订单卡生产 / 产品变更卡生产',
|
|
CaseLabelBit::toText(CaseLabelBit::APPLIANCE_NEED_MONEY | CaseLabelBit::UPGRADE_NEED_MONEY)
|
|
);
|
|
}
|
|
|
|
public function test_unknown_bit_falls_back_to_generic_label(): void
|
|
{
|
|
$this->assertSame('未知标记位 16', CaseLabelBit::crmLabel(16));
|
|
$this->assertStringContainsString('未在 CRM 枚举中定义', CaseLabelBit::description(16));
|
|
}
|
|
}
|