<?php

namespace Tests\Feature;

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

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

        $this->get('/admin/plans')
            ->assertOk()
            ->assertSee('关联订阅总量')
            ->assertSee('关联平台订单总量')
            ->assertSee('/admin/site-subscriptions?back=%2Fadmin%2Fplans', false)
            ->assertSee('/admin/platform-orders?back=%2Fadmin%2Fplans', false);
    }
}
