<?php

namespace Tests\Feature;

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

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

        // 使用“不可能命中”的 keyword 强制列表进入空集合，从而验证空态 td 的统一 class。
        $kw = '___no_such_keyword_' . uniqid() . '___';

        $platformOrders = $this->get('/admin/platform-orders?keyword=' . urlencode($kw));
        $platformOrders->assertOk();
        $platformOrders->assertSee('table-empty', false);

        $subscriptions = $this->get('/admin/site-subscriptions?keyword=' . urlencode($kw));
        $subscriptions->assertOk();
        $subscriptions->assertSee('table-empty', false);

        $plans = $this->get('/admin/plans?keyword=' . urlencode($kw));
        $plans->assertOk();
        $plans->assertSee('table-empty', false);
    }
}
