From 7324e3de334955d6d9a1bf57466ac96095614bfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Wed, 18 Mar 2026 22:05:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=BC=BA=E7=BA=BF=E7=B4=A2=E9=A1=B5?= =?UTF-8?q?=E5=B7=B2=E4=BB=98=E6=97=A0=E5=9B=9E=E6=89=A7=E5=85=A5=E5=8F=A3?= =?UTF-8?q?=E5=9B=9E=E8=B7=B3=E6=8A=A4=E6=A0=8F=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...anceLinkShouldUseLeadIndexSelfBackTest.php | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 tests/Feature/AdminPlatformLeadIndexPaidNoReceiptGovernanceLinkShouldUseLeadIndexSelfBackTest.php diff --git a/tests/Feature/AdminPlatformLeadIndexPaidNoReceiptGovernanceLinkShouldUseLeadIndexSelfBackTest.php b/tests/Feature/AdminPlatformLeadIndexPaidNoReceiptGovernanceLinkShouldUseLeadIndexSelfBackTest.php new file mode 100644 index 0000000..b785f2a --- /dev/null +++ b/tests/Feature/AdminPlatformLeadIndexPaidNoReceiptGovernanceLinkShouldUseLeadIndexSelfBackTest.php @@ -0,0 +1,68 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_paid_no_receipt_governance_link_should_use_lead_index_self_as_back(): void + { + $this->loginAsPlatformAdmin(); + + $plan = Plan::query()->create([ + 'code' => 'lead_index_paid_no_receipt_back_plan', + 'name' => '线索页已付无回执入口 back 口径测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 99, + 'list_price' => 99, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + $lead = PlatformLead::query()->create([ + 'name' => '线索已付无回执回跳测试', + 'mobile' => '13900000009', + 'email' => 'lead-paid-no-receipt-back@example.com', + 'company' => '线索治理回跳测试公司', + 'plan_id' => $plan->id, + 'source' => 'web', + 'status' => 'new', + ]); + + $res = $this->get('/admin/platform-leads?back=' . urlencode('/admin/platform-orders?payment_status=paid')); + $res->assertOk(); + + $html = (string) $res->getContent(); + $matched = preg_match('/]+href="([^"]+)"[^>]*>\s*已付无回执\s*<\/a>/u', $html, $m); + $this->assertSame(1, $matched, '未找到线索页“已付无回执”入口'); + + $href = html_entity_decode($m[1] ?? ''); + $expectedUrl = '/admin/platform-orders?' . Arr::query([ + 'lead_id' => $lead->id, + 'payment_status' => 'paid', + 'receipt_status' => 'none', + 'back' => '/admin/platform-leads', + ]); + + $this->assertSame($expectedUrl, $href); + $this->assertStringNotContainsString(urlencode('/admin/platform-orders?payment_status=paid'), $href); + } +}