feat(billing): 平台订单创建页展示订阅关联提示并加测试

This commit is contained in:
萝卜
2026-03-11 03:17:58 +00:00
parent 83de69c081
commit 7707bf6a03
3 changed files with 58 additions and 0 deletions

View File

@@ -47,6 +47,46 @@ class AdminPlatformOrderCreateTest extends TestCase
$res->assertSee('创建订单');
}
public function test_platform_admin_can_open_create_platform_order_form_with_site_subscription_hint(): void
{
$this->loginAsPlatformAdmin();
$merchant = Merchant::query()->firstOrFail();
$plan = Plan::query()->create([
'code' => 'create_order_plan_01b',
'name' => '创建订单测试套餐(订阅联动)',
'billing_cycle' => 'monthly',
'price' => 100,
'list_price' => 100,
'status' => 'active',
'sort' => 10,
'published_at' => now(),
]);
$sub = \App\Models\SiteSubscription::query()->create([
'merchant_id' => $merchant->id,
'plan_id' => $plan->id,
'status' => 'activated',
'source' => 'manual',
'subscription_no' => 'SUB_CREATE_ORDER_HINT_0001',
'plan_name' => $plan->name,
'billing_cycle' => 'monthly',
'period_months' => 1,
'amount' => 88,
'starts_at' => now()->subDays(2),
'ends_at' => now()->addDays(20),
'activated_at' => now()->subDays(2),
]);
$res = $this->get('/admin/platform-orders/create?site_subscription_id=' . $sub->id);
$res->assertOk();
$res->assertSee('本订单将关联订阅:');
$res->assertSee('SUB_CREATE_ORDER_HINT_0001');
$res->assertSee('/admin/site-subscriptions/' . $sub->id);
}
public function test_platform_admin_can_create_platform_order_and_see_it_in_show_page(): void
{
$this->loginAsPlatformAdmin();