<?php

namespace Tests\Feature;

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

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

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

        // BAS 徽章区 copy
        $this->assertStringContainsString('data-copy-label="BAS run_id"', $html);
        $this->assertStringContainsString('data-copy-text="BAS_COPY_0001"', $html);

        // BMPA 徽章区 copy
        $this->assertStringContainsString('data-copy-label="BMPA run_id"', $html);
        $this->assertStringContainsString('data-copy-text="BMPA_COPY_0001"', $html);
    }
}
