<?php

namespace Tests\Feature;

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

class AdminPlatformOrderIndexQuickFiltersBmpaFailedAndSuccessShouldHaveDataRoleTest 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_bmpa_failed_and_success_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-failed"', $html);
        $this->assertStringContainsString('data-role="po-quickfilter-bmpa-success"', $html);

        $this->assertStringContainsString('bmpa_failed_only=1', $html);
        $this->assertStringContainsString('bmpa_success_only=1', $html);
    }
}
