refactor(run_id): 提炼RunId::short用于warning短展示并加单测

This commit is contained in:
萝卜
2026-03-17 18:43:25 +08:00
parent af806923b1
commit aefecd0cbe
3 changed files with 45 additions and 8 deletions

View File

@@ -0,0 +1,19 @@
<?php
namespace Tests\Unit;
use App\Support\RunId;
use PHPUnit\Framework\TestCase;
class RunIdShortTest extends TestCase
{
public function test_short_should_keep_original_when_not_long_enough(): void
{
$this->assertSame('BAS123456', RunId::short('BAS123456', 6, 4));
}
public function test_short_should_shorten_with_ellipsis(): void
{
$this->assertSame('BAS202…0001', RunId::short('BAS202603171234560001', 6, 4));
}
}