<?php

namespace Tests\Feature;

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

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

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

        // 一级分组标题
        $res->assertSee('收费中心');

        // 二级入口（收费闭环主链）
        $res->assertSee('href="/admin/platform-orders"', false);
        $res->assertSee('平台订单');

        $res->assertSee('href="/admin/site-subscriptions"', false);
        $res->assertSee('订阅管理');

        $res->assertSee('href="/admin/plans"', false);
        $res->assertSee('套餐管理');
    }
}
