<?php

namespace Tests\Feature;

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

class AdminPlatformOrderIndexQuickFiltersUnpaidAndPendingEffectiveShouldHaveDataRoleTest 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_unpaid_and_pending_effective_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-unpaid"', $html);
        $this->assertStringContainsString('data-role="po-quickfilter-pending-effective"', $html);

        // 钉死语义口径
        $this->assertStringContainsString('payment_status=unpaid', $html);
        $this->assertStringContainsString('payment_status=paid', $html);
        $this->assertStringContainsString('status=pending', $html);
        $this->assertStringContainsString('sync_status=unsynced', $html);
    }
}
