diff --git a/tests/Feature/AdminPlatformOrderIndexBatchFormsShouldDisableOnSubmitTest.php b/tests/Feature/AdminPlatformOrderIndexBatchFormsShouldDisableOnSubmitTest.php new file mode 100644 index 0000000..65b84dc --- /dev/null +++ b/tests/Feature/AdminPlatformOrderIndexBatchFormsShouldDisableOnSubmitTest.php @@ -0,0 +1,41 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_platform_order_index_batch_forms_should_disable_on_submit(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin/platform-orders'); + $res->assertOk(); + + $html = (string) $res->getContent(); + + // 高风险批量动作:必须带 data-action="disable-on-submit",避免运营重复点击造成重复请求。 + $this->assertStringContainsString('action="/admin/platform-orders/batch-activate-subscriptions"', $html); + $this->assertStringContainsString('action="/admin/platform-orders/batch-mark-paid-and-activate"', $html); + $this->assertStringContainsString('action="/admin/platform-orders/batch-mark-activated"', $html); + $this->assertStringContainsString('action="/admin/platform-orders/clear-sync-errors"', $html); + $this->assertStringContainsString('action="/admin/platform-orders/clear-bmpa-errors"', $html); + + // 至少出现多次(每个工具组含 filtered/all 两套表单) + $this->assertTrue(substr_count($html, 'data-action="disable-on-submit"') >= 6); + } +}