<?php

namespace Tests\Feature;

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

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

        $res = $this->get('/admin/site-subscriptions?attach_order_id=123&expiry=expired');
        $res->assertOk();

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

        // 在“绑定订阅到订单”模式下，工具区应专注绑定操作，避免出现批量治理动作造成误操作。
        $this->assertStringNotContainsString('action="/admin/site-subscriptions/batch-mark-expired"', $html);
        $this->assertStringNotContainsString('批量标记已过期（当前集合）', $html);
    }
}
