<?php

namespace Tests\Feature;

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

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

        $html = $this->get('/admin/platform-orders?batch_activation_run_id=BAS_TEST_0001&batch_bmpa_run_id=BMPA_TEST_0001')
            ->assertOk()
            ->getContent();

        // 过滤器 hidden inputs 组件应能透传新加的两个 run_id 字段
        $this->assertStringContainsString('name="batch_activation_run_id" value="BAS_TEST_0001"', $html);
        $this->assertStringContainsString('name="batch_bmpa_run_id" value="BMPA_TEST_0001"', $html);
    }
}
