<?php

namespace Tests\Feature;

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

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

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

        $html = (string) $res->getContent();
        $this->assertMatchesRegularExpression('/data-role="dashboard-po-no-receipt-row"[\s\S]*?已付无回执/u', $html);
        $this->assertMatchesRegularExpression('/data-role="ops-risk-no-receipt-row"[\s\S]*?已付无回执/u', $html);
    }
}
