<?php

namespace Tests\Feature;

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

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

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

        // 结构护栏：最近平台订单 table 必须可被稳定选择
        $res->assertSee('data-role="recent-platform-orders-table"', false);

        $css = (string) file_get_contents(public_path('css/admin-components.css'));

        // CSS 护栏：第 4 列（支付）必须明确 nowrap + min-width
        $this->assertStringContainsString('[data-role="recent-platform-orders-table"] th:nth-child(4)', $css);
        $this->assertStringContainsString('white-space:nowrap', $css);
        $this->assertStringContainsString('min-width:56px', $css);
    }
}
