<?php

namespace Tests\Feature;

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

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

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

        // 工具区：两列分组卡片化（避免回退成散落/错乱布局）
        $res->assertSee('tool-grid', false);
        $res->assertSee('tool-group', false);
        $res->assertSee('tool-group-title', false);

        $res->assertSee('导出', false);
        $res->assertSee('批量同步订阅', false);
        $res->assertSee('批量标记支付并生效（BMPA）', false);
        $res->assertSee('批量仅标记为已生效', false);
        $res->assertSee('清理失败标记：同步订阅', false);
        $res->assertSee('清理失败标记：批量 BMPA', false);
    }
}
