<?php

namespace Tests\Feature;

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

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

        // receipt_status=none 属于“收费闭环缺口”治理集合：应先补回执留痕，再批量同步订阅
        $res = $this->post('/admin/platform-orders/batch-activate-subscriptions', [
            'scope' => 'filtered',
            'syncable_only' => '1',
            'receipt_status' => 'none',
            'limit' => 50,
        ]);

        $res->assertRedirect();
        $res->assertSessionHas('warning');
    }
}
