test(billing): guardrails for platform order create form fields

This commit is contained in:
萝卜
2026-03-16 07:38:57 +08:00
parent de54107bab
commit 084b871e87

View File

@@ -47,6 +47,35 @@ class AdminPlatformOrderCreateTest extends TestCase
$res->assertSee('创建订单'); $res->assertSee('创建订单');
} }
public function test_platform_order_create_form_should_render_core_fields(): void
{
$this->loginAsPlatformAdmin();
// 需要至少一个套餐供选择
Plan::query()->create([
'code' => 'create_order_plan_fields_01',
'name' => '创建订单字段渲染测试套餐',
'billing_cycle' => 'monthly',
'price' => 100,
'list_price' => 100,
'status' => 'active',
'sort' => 10,
'published_at' => now(),
]);
$res = $this->get('/admin/platform-orders/create');
$res->assertOk();
// Guardrails: 页面必须渲染出核心表单字段,否则运营无法下单。
$res->assertSee('form-grid', false);
$res->assertSee('name="merchant_id"', false);
$res->assertSee('name="plan_id"', false);
$res->assertSee('name="order_type"', false);
$res->assertSee('name="quantity"', false);
$res->assertSee('创建订单');
}
public function test_platform_admin_can_open_create_platform_order_form_with_site_subscription_hint(): void public function test_platform_admin_can_open_create_platform_order_form_with_site_subscription_hint(): void
{ {
$this->loginAsPlatformAdmin(); $this->loginAsPlatformAdmin();