<?php

namespace Tests\Feature;

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

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

        $res = $this->get('/admin/site-subscriptions?' . Arr::query([
            'expiry' => 'expiring_7d',
            'merchant_id' => 2,
            'plan_id' => 3,
        ]));

        $res->assertOk();

        $res->assertSee('创建续费订单（当前集合）', false);
        $res->assertSee('require_subscription=1', false);
    }
}
