<?php

namespace Tests\Feature;

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

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

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

        $res->assertSee('快捷筛选');

        $res->assertSee('href="/admin/platform-orders?bmpa_processable_only=1&back=%2Fadmin"', false);
        $res->assertSee('待支付');

        $res->assertSee('href="/admin/platform-orders?payment_status=paid&status=pending&sync_status=unsynced&back=%2Fadmin"', false);
        $res->assertSee('待生效');

        $res->assertSee('href="/admin/platform-orders?syncable_only=1&sync_status=unsynced&back=%2Fadmin"', false);
        $res->assertSee('可同步');

        $res->assertSee('href="/admin/platform-orders?sync_status=failed&back=%2Fadmin"', false);
        $res->assertSee('同步失败');
    }
}
