From b2fe4abbacb1756ec1ae1e6039d5dee486a9d75a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Sun, 15 Mar 2026 17:35:29 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E8=AE=A2=E5=8D=95=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E7=BB=91=E5=AE=9A=E8=AE=A2=E9=98=85=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E9=98=B2=E9=87=8D=E5=A4=8D=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/platform_orders/show.blade.php | 2 +- ...scriptionFormShouldDisableOnSubmitTest.php | 66 +++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 tests/Feature/AdminPlatformOrderShowAttachSubscriptionFormShouldDisableOnSubmitTest.php diff --git a/resources/views/admin/platform_orders/show.blade.php b/resources/views/admin/platform_orders/show.blade.php index 4b94952..978831b 100644 --- a/resources/views/admin/platform_orders/show.blade.php +++ b/resources/views/admin/platform_orders/show.blade.php @@ -465,7 +465,7 @@
-
+ @csrf diff --git a/tests/Feature/AdminPlatformOrderShowAttachSubscriptionFormShouldDisableOnSubmitTest.php b/tests/Feature/AdminPlatformOrderShowAttachSubscriptionFormShouldDisableOnSubmitTest.php new file mode 100644 index 0000000..8f2f7a8 --- /dev/null +++ b/tests/Feature/AdminPlatformOrderShowAttachSubscriptionFormShouldDisableOnSubmitTest.php @@ -0,0 +1,66 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_show_attach_subscription_form_should_have_disable_on_submit_marker(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'po_show_attach_form_disable_plan', + 'name' => '订单详情绑定订阅表单防重复提交测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 30, + 'list_price' => 30, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + $order = PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_SHOW_ATTACH_FORM_DISABLE_0001', + 'order_type' => 'renewal', + 'status' => 'pending', + 'payment_status' => 'unpaid', + 'plan_name' => $plan->name, + 'billing_cycle' => $plan->billing_cycle, + 'period_months' => 1, + 'quantity' => 1, + 'payable_amount' => 30, + 'paid_amount' => 0, + 'placed_at' => now(), + 'meta' => [], + ]); + + $res = $this->get('/admin/platform-orders/' . $order->id); + $res->assertOk(); + + $html = (string) $res->getContent(); + + $this->assertStringContainsString('/admin/platform-orders/' . $order->id . '/attach-subscription', $html); + $this->assertStringContainsString('data-action="disable-on-submit"', $html); + } +}