<?php

namespace Tests\Feature;

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

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

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

        $res->assertSee('到期治理');

        // 链接应使用 quick filter：仅 expiry，不附带 status
        $res->assertSee('href="/admin/site-subscriptions?expiry=expired"', false);
        $res->assertSee('href="/admin/site-subscriptions?expiry=expiring_7d"', false);

        $res->assertSee('已过期');
        $res->assertSee('7天内到期');
    }
}
