补强回执筛选说明已付无回执自一致护栏

This commit is contained in:
萝卜
2026-03-19 03:35:10 +08:00
parent 3f59a36eb9
commit 47f1ee9301

View File

@@ -0,0 +1,48 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Arr;
use Tests\TestCase;
class AdminPlatformOrderFiltersReceiptStatusHintLinkShouldStayOnPaidNoReceiptScopeTest 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_status_hint_link_should_stay_on_paid_no_receipt_scope_when_already_there(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin/platform-orders?' . Arr::query([
'payment_status' => 'paid',
'receipt_status' => 'none',
'merchant_id' => 2,
'plan_id' => 3,
'back' => '/admin/plans',
]));
$res->assertOk();
$html = (string) $res->getContent();
preg_match('/data-role="po-receipt-status-broad-none-go-paid-no-receipt"[^>]*href="([^"]+)"/u', $html, $m);
$href = html_entity_decode($m[1] ?? '');
$query = parse_url($href, PHP_URL_QUERY) ?: '';
parse_str($query, $q);
$this->assertSame('paid', (string) ($q['payment_status'] ?? ''));
$this->assertSame('none', (string) ($q['receipt_status'] ?? ''));
$this->assertSame('2', (string) ($q['merchant_id'] ?? ''));
$this->assertSame('3', (string) ($q['plan_id'] ?? ''));
$this->assertSame('/admin/plans', (string) ($q['back'] ?? ''));
}
}