<?php

namespace Tests\Feature;

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

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

        // 不在 expiry=expired 集合时，按钮应禁用并出现 blocked hint + 一键跳转。
        $res = $this->get('/admin/site-subscriptions');
        $res->assertOk();

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

        $this->assertStringContainsString('data-role="batch-mark-expired-blocked-hint"', $html);
        $this->assertStringContainsString('切到已过期集合', $html);
        $this->assertStringContainsString('expiry=expired', $html);
    }
}
