修正全部快捷筛选 back 转义断言为链接级护栏

This commit is contained in:
萝卜
2026-03-18 16:53:41 +08:00
parent b3a3ad4b38
commit e6f37c9f8f

View File

@@ -31,7 +31,10 @@ class AdminPlatformOrderIndexQuickFilterAllShouldKeepBackAndClearFiltersTest ext
$this->assertMatchesRegularExpression('/<a[^>]*data-role="po-quickfilter-all"[^>]*href="([^"]+)"/u', $html);
preg_match('/<a[^>]*data-role="po-quickfilter-all"[^>]*href="([^"]+)"/u', $html, $m);
$href = html_entity_decode($m[1] ?? '');
$rawHref = (string) ($m[1] ?? '');
$this->assertStringNotContainsString('&amp;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 成 &amp;back= 导致 back 被错误编码/叠加
$res->assertDontSee('&amp;back=', false);
// 说明:页面其他区域(如分页链接)可能会出现 &amp;back= 的转义字符,这里不做全局断言。
// 我们仅保证该快捷筛选链接本身被正确解析(见上文 parse_str 后的断言)。
}
}