<?php

namespace Tests\Feature;

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

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

        // 说明：bmpa_processable_only 本身在 applyFilters() 会强制限定 status/payment_status 等口径。
        // 若用户同时带了其它筛选（例如 status/payment_status/sync_status/bmpa_failed_only），结果可能为空，但不应报错/500。
        $this->get('/admin/platform-orders?bmpa_processable_only=1&status=activated&payment_status=paid&sync_status=synced&bmpa_failed_only=1')
            ->assertOk();
    }
}
