43 lines
1.4 KiB
PHP
43 lines
1.4 KiB
PHP
<?php
|
||
|
||
namespace Tests\Feature;
|
||
|
||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||
use Tests\TestCase;
|
||
|
||
class AdminDashboardBillingWorkbenchQuickLinksCountShouldBeAtMost7Test extends TestCase
|
||
{
|
||
use RefreshDatabase;
|
||
|
||
protected function loginAsPlatformAdmin(): void
|
||
{
|
||
$this->seed();
|
||
|
||
$this->post('/admin/login', [
|
||
'email' => 'platform.admin@demo.local',
|
||
'password' => 'Platform@123456',
|
||
])->assertRedirect('/admin');
|
||
}
|
||
|
||
public function test_dashboard_billing_workbench_quick_links_count_should_be_at_most_7(): void
|
||
{
|
||
$this->loginAsPlatformAdmin();
|
||
|
||
$res = $this->get('/admin');
|
||
$res->assertOk();
|
||
|
||
$html = (string) $res->getContent();
|
||
|
||
// Guardrail:收费工作台“快捷治理”按钮数量必须收敛(<=7)。
|
||
// 说明:避免后续继续膨胀回到“暴露所有维度”的旧路。
|
||
preg_match_all('/data-role="dashboard-po-quicklink-[^"]+"/', $html, $m);
|
||
$count = is_array($m[0] ?? null) ? count($m[0]) : 0;
|
||
|
||
$this->assertGreaterThanOrEqual(1, $count, '未找到任何 dashboard-po-quicklink(可能误删了快捷区或 data-role 口径漂移)');
|
||
$this->assertLessThanOrEqual(7, $count, '收费工作台快捷入口不应超过 7 个(应下沉到高级筛选)');
|
||
|
||
// 当前版本固定为 6,防止不小心又多塞入口。
|
||
$this->assertSame(6, $count);
|
||
}
|
||
}
|