From e6f37c9f8f59ba9fc019aea077b154cc0ac93db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Wed, 18 Mar 2026 16:53:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=85=A8=E9=83=A8=E5=BF=AB?= =?UTF-8?q?=E6=8D=B7=E7=AD=9B=E9=80=89=20back=20=E8=BD=AC=E4=B9=89?= =?UTF-8?q?=E6=96=AD=E8=A8=80=E4=B8=BA=E9=93=BE=E6=8E=A5=E7=BA=A7=E6=8A=A4?= =?UTF-8?q?=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...exQuickFilterAllShouldKeepBackAndClearFiltersTest.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/Feature/AdminPlatformOrderIndexQuickFilterAllShouldKeepBackAndClearFiltersTest.php b/tests/Feature/AdminPlatformOrderIndexQuickFilterAllShouldKeepBackAndClearFiltersTest.php index eecadf3..577a52f 100644 --- a/tests/Feature/AdminPlatformOrderIndexQuickFilterAllShouldKeepBackAndClearFiltersTest.php +++ b/tests/Feature/AdminPlatformOrderIndexQuickFilterAllShouldKeepBackAndClearFiltersTest.php @@ -31,7 +31,10 @@ class AdminPlatformOrderIndexQuickFilterAllShouldKeepBackAndClearFiltersTest ext $this->assertMatchesRegularExpression('/]*data-role="po-quickfilter-all"[^>]*href="([^"]+)"/u', $html); preg_match('/]*data-role="po-quickfilter-all"[^>]*href="([^"]+)"/u', $html, $m); - $href = html_entity_decode($m[1] ?? ''); + $rawHref = (string) ($m[1] ?? ''); + $this->assertStringNotContainsString('&back=', $rawHref); + + $href = html_entity_decode($rawHref); $this->assertNotEmpty($href); $this->assertSame('/admin/platform-orders', (string) parse_url($href, PHP_URL_PATH)); @@ -43,7 +46,7 @@ class AdminPlatformOrderIndexQuickFilterAllShouldKeepBackAndClearFiltersTest ext $this->assertArrayNotHasKey('merchant_id', $q); $this->assertArrayNotHasKey('reconcile_mismatch', $q); - // 避免 Blade 把 back 参数 escape 成 &back= 导致 back 被错误编码/叠加 - $res->assertDontSee('&back=', false); + // 说明:页面其他区域(如分页链接)可能会出现 &back= 的转义字符,这里不做全局断言。 + // 我们仅保证该快捷筛选链接本身被正确解析(见上文 parse_str 后的断言)。 } }