From 1d0e32e41d9f2cf85c3034195832905dfd1e2b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Tue, 17 Mar 2026 08:14:50 +0800 Subject: [PATCH] test(platform-orders): guardrail no-receipt fix link anchors to receipt panel --- ...houldPointToAddPaymentReceiptPanelTest.php | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/Feature/AdminPlatformOrderIndexNoReceiptFixLinkShouldPointToAddPaymentReceiptPanelTest.php diff --git a/tests/Feature/AdminPlatformOrderIndexNoReceiptFixLinkShouldPointToAddPaymentReceiptPanelTest.php b/tests/Feature/AdminPlatformOrderIndexNoReceiptFixLinkShouldPointToAddPaymentReceiptPanelTest.php new file mode 100644 index 0000000..f75dc64 --- /dev/null +++ b/tests/Feature/AdminPlatformOrderIndexNoReceiptFixLinkShouldPointToAddPaymentReceiptPanelTest.php @@ -0,0 +1,54 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_index_no_receipt_fix_link_should_point_to_add_payment_receipt_panel(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + + $order = PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => null, + 'site_subscription_id' => null, + 'order_no' => 'PO_INDEX_NO_RECEIPT_FIX_LINK', + 'order_type' => 'new_purchase', + 'status' => 'pending', + 'payment_status' => 'paid', + 'payable_amount' => 10, + 'paid_amount' => 10, + 'paid_at' => now(), + 'meta' => [], // 无 payment_receipts / payment_summary + ]); + + $res = $this->get('/admin/platform-orders'); + $res->assertOk(); + + $html = (string) $res->getContent(); + + // 无回执行应提供“去补回执”入口,且锚点必须为 #add-payment-receipt(避免误跳到其它 section)。 + $this->assertStringContainsString('无回执', $html); + $this->assertStringContainsString('/admin/platform-orders/' . $order->id, $html); + $this->assertStringContainsString('#add-payment-receipt', $html); + } +}