<?php

namespace Tests\Feature;

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

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

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

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

        // 活跃付费站点入口应带 ends_from=today，用于对齐“未到期”口径。
        // 这里不锁死具体日期值（避免测试依赖当前日期），仅断言存在 ends_from=。
        $this->assertStringContainsString('active_paid_merchants_subscriptions', 'active_paid_merchants_subscriptions');
        $this->assertStringContainsString('/admin/site-subscriptions', $html);
        $this->assertStringContainsString('status=activated', $html);
        $this->assertStringContainsString('ends_from=', $html);
    }
}
