From aab3871814d0890b560cf6b4edb5714e6df38a62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Fri, 20 Mar 2026 08:51:30 +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=E9=A1=B6=E9=83=A8=E5=8A=A8=E4=BD=9C=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 | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/Feature/AdminPlanShowTest.php b/tests/Feature/AdminPlanShowTest.php index 3ca7dd0..e097687 100644 --- a/tests/Feature/AdminPlanShowTest.php +++ b/tests/Feature/AdminPlanShowTest.php @@ -240,4 +240,41 @@ class AdminPlanShowTest extends TestCase $res->assertSee($expectedPaidNoReceiptUrl, false); $res->assertDontSee('back=' . $safeBack, false); } + + public function test_plan_show_header_actions_should_use_plan_show_self_back_even_when_safe_back_is_present(): void + { + $this->loginAsPlatformAdmin(); + + $plan = Plan::query()->create([ + 'code' => 'plan_show_header_cta_back_test', + 'name' => '套餐详情顶部动作回链测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 66, + 'list_price' => 88, + 'status' => 'active', + 'sort' => 10, + ]); + + $safeBack = '/admin/plans?' . Arr::query([ + 'status' => 'active', + 'billing_cycle' => 'monthly', + ]); + + $res = $this->get('/admin/plans/' . $plan->id . '?back=' . urlencode($safeBack)); + $res->assertOk(); + + $planShowSelf = '/admin/plans/' . $plan->id; + $expectedEditUrl = '/admin/plans/' . $plan->id . '/edit?' . Arr::query([ + 'back' => $planShowSelf, + ]); + $expectedCreateOrderUrl = '/admin/platform-orders/create?' . Arr::query([ + 'plan_id' => $plan->id, + 'order_type' => 'new_purchase', + 'back' => $planShowSelf, + ]); + + $res->assertSee($expectedEditUrl, false); + $res->assertSee($expectedCreateOrderUrl, false); + $res->assertDontSee('back=' . $safeBack, false); + } }