From 06f1497b6e41dc944fc7cb7d2d05c1f316487f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Fri, 13 Mar 2026 14:59:35 +0000 Subject: [PATCH] =?UTF-8?q?test:=20=E5=A5=97=E9=A4=90=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E8=A1=A8=E5=8D=95=E9=80=8F=E4=BC=A0=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E5=8F=A3=E5=BE=84=E6=8A=A4=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdminPlanIndexKeepFiltersOnLinksTest.php | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/Feature/AdminPlanIndexKeepFiltersOnLinksTest.php diff --git a/tests/Feature/AdminPlanIndexKeepFiltersOnLinksTest.php b/tests/Feature/AdminPlanIndexKeepFiltersOnLinksTest.php new file mode 100644 index 0000000..ee581fa --- /dev/null +++ b/tests/Feature/AdminPlanIndexKeepFiltersOnLinksTest.php @@ -0,0 +1,50 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_plans_index_tools_export_form_keeps_filters(): void + { + $this->loginAsPlatformAdmin(); + + Plan::query()->create([ + 'code' => 'plan_keep_filters_01', + 'name' => '筛选透传测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 9.9, + 'list_price' => 9.9, + 'status' => 'active', + 'sort' => 1, + 'published_at' => now(), + ]); + + $res = $this->get('/admin/plans?status=active&billing_cycle=monthly&published=published&keyword=' . urlencode('筛选')); + $res->assertOk(); + + // 导出表单 hidden input 透传筛选口径 + $res->assertSee('
', false); + $res->assertSee('', false); + $res->assertSee('', false); + $res->assertSee('', false); + + // keyword 可能包含 URL 编码字符,这里只校验 name 存在,避免脆弱断言 + $res->assertSee('name="keyword"', false); + } +}