<?php

namespace Tests\Feature;

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

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

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

        $html = (string) $res->getContent();
        $this->assertMatchesRegularExpression('/data-role="po-summary-card-paid-no-receipt"[\s\S]*?已付无回执订单[\s\S]*?po-summary-link-no-receipt-orders[\s\S]*?po-summary-paid-no-receipt-footnote/u', $html);
    }
}
