<?php

namespace Tests\Feature;

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

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

        $res = $this->get('/admin/platform-orders');
        $res->assertOk();

        $html = (string) $res->getContent();

        $this->assertStringContainsString('data-role="po-quickfilter-bmpa-processable"', $html);
        $this->assertStringContainsString('data-role="po-quickfilter-syncable"', $html);
        $this->assertStringContainsString('data-role="po-quickfilter-sync-failed"', $html);

        // 也钉一下关键 query 语义，避免链接口径被误改
        $this->assertStringContainsString('bmpa_processable_only=1', $html);
        $this->assertStringContainsString('syncable_only=1', $html);
        $this->assertStringContainsString('sync_status=failed', $html);
    }
}
