<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class AdminDashboardBillingWorkbenchQuickLinksShouldBeGovernanceOrientedTest 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_should_be_governance_oriented(): void
    {
        $this->loginAsPlatformAdmin();

        $res = $this->get('/admin');
        $res->assertOk();

        $html = (string) $res->getContent();

        // 快捷区：只保留“点完能做事”的治理入口（<=7，当前为 6）
        $this->assertStringContainsString('data-role="dashboard-po-quick-links"', $html);
        $this->assertStringContainsString('可BMPA处理', $html);
        $this->assertStringContainsString('可同步', $html);
        $this->assertStringContainsString('同步失败', $html);
        $this->assertStringContainsString('已付无回执', $html);
        $this->assertStringContainsString('对账不一致', $html);
        $this->assertStringContainsString('退款不一致', $html);

        // 高级筛选：默认收起（存在即可），承载“非高频动作入口”
        $this->assertStringContainsString('data-role="dashboard-po-advanced-links"', $html);
        $this->assertStringContainsString('高级筛选', $html);
        $this->assertStringContainsString('待生效', $html);
        $this->assertStringContainsString('续费缺订阅', $html);
        $this->assertStringContainsString('BMPA失败', $html);
        $this->assertStringContainsString('BMPA成功', $html);
    }
}
