<?php

namespace Tests\Feature;

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

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

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

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

        $this->assertStringContainsString('今天到期', $html);
        $this->assertStringContainsString('近7天到期', $html);
        $this->assertStringContainsString('近30天到期', $html);
        $this->assertStringContainsString('清空到期区间', $html);
        $this->assertStringContainsString('ends_from=', $html);
        $this->assertStringContainsString('ends_to=', $html);
    }
}
