<?php

namespace Tests\Feature;

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

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

        $syncRes = $this->post('/admin/platform-orders/batch-activate-subscriptions', [
            'scope' => 'filtered',
            'receipt_status' => 'none',
            'syncable_only' => '1',
        ]);
        $syncRes->assertRedirect();
        $syncRes->assertSessionHas('warning');
        $this->assertStringContainsString('无回执（广义）', (string) session('warning'));
    }
}
