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); + } +}