From 0bd21f8715359029c47c2e8ec29b909e3f9bc56b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Sun, 15 Mar 2026 08:31:15 +0000 Subject: [PATCH] =?UTF-8?q?test(admin):=20=E7=BA=BF=E7=B4=A2=E9=A1=B5?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E7=BB=AD=E8=B4=B9=E8=AE=A2=E5=8D=95=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=E5=BA=94=E9=A2=84=E5=A1=AB=20merchant=5Fid=EF=BC=88?= =?UTF-8?q?=E4=BB=8E=20lead=20meta=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...houldPrefillMerchantIdFromLeadMetaTest.php | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 tests/Feature/AdminPlatformLeadIndexCreateRenewalOrderLinkShouldPrefillMerchantIdFromLeadMetaTest.php diff --git a/tests/Feature/AdminPlatformLeadIndexCreateRenewalOrderLinkShouldPrefillMerchantIdFromLeadMetaTest.php b/tests/Feature/AdminPlatformLeadIndexCreateRenewalOrderLinkShouldPrefillMerchantIdFromLeadMetaTest.php new file mode 100644 index 0000000..9fbe009 --- /dev/null +++ b/tests/Feature/AdminPlatformLeadIndexCreateRenewalOrderLinkShouldPrefillMerchantIdFromLeadMetaTest.php @@ -0,0 +1,67 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_create_renewal_order_link_should_prefill_merchant_id_from_lead_meta(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + + $plan = Plan::query()->create([ + 'code' => 'lead_index_create_renewal_prefill_merchant_plan', + 'name' => '线索页创建续费订单入口预填站点测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 10, + 'list_price' => 10, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + $lead = PlatformLead::query()->create([ + 'status' => 'new', + 'name' => '李四', + 'mobile' => '13900000000', + 'email' => 'ls@example.com', + 'company' => '测试公司2', + 'plan_id' => $plan->id, + 'source' => 'test', + 'meta' => [ + 'merchant_id' => $merchant->id, + ], + ]); + + $res = $this->get('/admin/platform-leads'); + $res->assertOk(); + + $html = (string) $res->getContent(); + + // create renewal url should include merchant_id + $this->assertStringContainsString('创建续费订单', $html); + $this->assertStringContainsString('merchant_id=' . $merchant->id, $html); + $this->assertStringContainsString('plan_id=' . $plan->id, $html); + $this->assertStringContainsString('require_subscription=1', $html); + $this->assertStringContainsString('lead_id=' . $lead->id, $html); + } +}