Files
saasshop/tests/Feature/AdminPlatformOrderReceiptSummaryCardShouldUsePaidNoReceiptScopeTest.php

43 lines
1.3 KiB
PHP

<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformOrderReceiptSummaryCardShouldUsePaidNoReceiptScopeTest 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_receipt_summary_card_should_use_paid_no_receipt_scope(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin/platform-orders');
$res->assertOk();
$html = (string) $res->getContent();
$this->assertStringContainsString('已付无回执订单', $html);
$matched = preg_match('/data-role="po-summary-link-no-receipt-orders"[^>]*href="([^"]+)"/u', $html, $m);
$this->assertSame(1, $matched, '未找到平台订单列表摘要卡“已付无回执订单”链接');
$href = html_entity_decode($m[1] ?? '');
$parts = parse_url($href);
parse_str($parts['query'] ?? '', $q);
$this->assertSame('paid', (string) ($q['payment_status'] ?? ''));
$this->assertSame('none', (string) ($q['receipt_status'] ?? ''));
}
}