<?php

namespace Tests\Feature;

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

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

        $this->get('/admin/platform-orders?plan_id=123&page=2')
            ->assertOk()
            ->assertSee('治理顺序建议（SOP）')
            // 链接需保留筛选上下文 plan_id=123，且清空 page
            ->assertSee('plan_id=123', false)
            ->assertSee('reconcile_mismatch=1', false)
            ->assertSee('refund_inconsistent=1', false)
            ->assertSee('syncable_only=1', false)
            ->assertDontSee('page=2', false);
    }
}
