<?php

namespace Tests\Feature;

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

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

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

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

        $this->assertStringContainsString('data-role="dashboard-po-quicklink-bmpa-processable"', $html);

        // 口径：可BMPA处理入口应指向 bmpa_processable_only=1 集合（避免只靠“unpaid_pending”等内部别名导致语义漂移）
        $this->assertStringContainsString('bmpa_processable_only=1', $html);
    }
}
