From 1ecd99f5b4bbc2ce04faaf867cc0cc57f798e9d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Fri, 20 Mar 2026 10:37:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E9=BD=90=E5=A5=97=E9=A4=90=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E8=AE=A2=E9=98=85=E6=B2=BB=E7=90=86=E5=9B=9E?= =?UTF-8?q?=E9=93=BE=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/Feature/AdminPlanShowTest.php | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tests/Feature/AdminPlanShowTest.php b/tests/Feature/AdminPlanShowTest.php index ed659fe..59d867f 100644 --- a/tests/Feature/AdminPlanShowTest.php +++ b/tests/Feature/AdminPlanShowTest.php @@ -364,5 +364,47 @@ class AdminPlanShowTest extends TestCase $res->assertDontSee('back=' . $unsafeBack, false); $res->assertDontSee('back%3D', false); } + + public function test_plan_show_should_render_safe_back_but_subscription_governance_links_should_still_use_plan_show_self_back(): void + { + $this->loginAsPlatformAdmin(); + + $plan = Plan::query()->create([ + 'code' => 'plan_show_subscription_governance_safe_back_test', + 'name' => '套餐详情订阅治理入口 safe back 测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 96, + 'list_price' => 126, + 'status' => 'active', + 'sort' => 10, + ]); + + $safeBack = '/admin/plans?' . Arr::query([ + 'status' => 'active', + 'keyword' => '订阅治理', + ]); + + $res = $this->get('/admin/plans/' . $plan->id . '?back=' . urlencode($safeBack)); + $res->assertOk(); + + $res->assertSee('href="' . $safeBack . '"', false); + $res->assertSee('返回上一页(保留上下文)'); + + $planShowSelf = '/admin/plans/' . $plan->id; + + $expectedSubscriptionsUrl = '/admin/site-subscriptions?' . Arr::query([ + 'plan_id' => $plan->id, + 'back' => $planShowSelf, + ]); + $expectedExpiringSubscriptionsUrl = '/admin/site-subscriptions?' . Arr::query([ + 'plan_id' => $plan->id, + 'expiry' => 'expiring_7d', + 'back' => $planShowSelf, + ]); + + $res->assertSee($expectedSubscriptionsUrl, false); + $res->assertSee($expectedExpiringSubscriptionsUrl, false); + $res->assertDontSee('back=' . $safeBack, false); + } }