From 7a369d7653c630e4a684d74e40f424b0e531e3b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Wed, 18 Mar 2026 13:51:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95:=20=E6=B2=BB=E7=90=86?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E5=8C=BA=E8=B7=A8=E9=9B=86=E5=90=88=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E6=B8=85=E7=90=86=E5=86=B2=E7=AA=81=E5=BC=80=E5=85=B3?= =?UTF-8?q?=E6=8A=A4=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...atformOrderToolsBmpaGovernanceHintTest.php | 25 +++++++++++++++++++ ...inPlatformOrderToolsGovernanceHintTest.php | 25 +++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/tests/Feature/AdminPlatformOrderToolsBmpaGovernanceHintTest.php b/tests/Feature/AdminPlatformOrderToolsBmpaGovernanceHintTest.php index 4533339..c2a9907 100644 --- a/tests/Feature/AdminPlatformOrderToolsBmpaGovernanceHintTest.php +++ b/tests/Feature/AdminPlatformOrderToolsBmpaGovernanceHintTest.php @@ -68,4 +68,29 @@ class AdminPlatformOrderToolsBmpaGovernanceHintTest extends TestCase $res->assertSee('进入批量标记支付失败集合', false); $res->assertSee('切到可BMPA处理(用于重试)', false); } + + public function test_tools_go_bmpa_failed_link_should_clear_sync_failed_filters_when_cross_context(): void + { + $this->loginAsPlatformAdmin(); + + // 模拟用户在同步失败上下文中又叠加了 BMPA 失败筛选; + // 此时“进入批量标记支付失败集合”的链接应显式清理 fail_only/sync_status/sync_error_keyword,避免跳转后产生筛选冲突。 + $res = $this->get('/admin/platform-orders?bmpa_failed_only=1&sync_status=failed'); + $res->assertOk(); + + $html = (string) $res->getContent(); + + $this->assertMatchesRegularExpression('/href="([^"]+)"[^>]*>进入批量标记支付失败集合<\/a>/', $html); + + preg_match('/href="([^"]+)"[^>]*>进入批量标记支付失败集合<\/a>/', $html, $m); + $href = html_entity_decode($m[1] ?? ''); + + $query = parse_url($href, PHP_URL_QUERY) ?: ''; + parse_str($query, $q); + + $this->assertSame('1', (string) ($q['bmpa_failed_only'] ?? '')); + $this->assertArrayNotHasKey('sync_status', $q); + $this->assertArrayNotHasKey('sync_error_keyword', $q); + $this->assertArrayNotHasKey('fail_only', $q); + } } diff --git a/tests/Feature/AdminPlatformOrderToolsGovernanceHintTest.php b/tests/Feature/AdminPlatformOrderToolsGovernanceHintTest.php index e84fb39..bd6d7d7 100644 --- a/tests/Feature/AdminPlatformOrderToolsGovernanceHintTest.php +++ b/tests/Feature/AdminPlatformOrderToolsGovernanceHintTest.php @@ -62,4 +62,29 @@ class AdminPlatformOrderToolsGovernanceHintTest extends TestCase ->assertSee('sync_status=failed', false) ->assertSee('syncable_only=1', false); } + + public function test_tools_go_sync_failed_link_should_clear_bmpa_filters_when_cross_context(): void + { + $this->loginAsPlatformAdmin(); + + // 模拟用户在 BMPA 失败上下文中又叠加了同步失败筛选; + // 此时“进入同步失败集合”的链接应显式清理 bmpa_failed_only/bmpa_error_keyword,避免跳转后产生筛选冲突。 + $res = $this->get('/admin/platform-orders?sync_status=failed&bmpa_failed_only=1'); + $res->assertOk(); + + $html = (string) $res->getContent(); + + // 只校验“进入同步失败集合”这一条链接本身的 query(避免页面其它区域也出现类似组合链接导致误报) + $this->assertMatchesRegularExpression('/href="([^"]+)"[^>]*>进入同步失败集合<\/a>/', $html); + + preg_match('/href="([^"]+)"[^>]*>进入同步失败集合<\/a>/', $html, $m); + $href = html_entity_decode($m[1] ?? ''); + + $query = parse_url($href, PHP_URL_QUERY) ?: ''; + parse_str($query, $q); + + $this->assertSame('failed', (string) ($q['sync_status'] ?? '')); + $this->assertArrayNotHasKey('bmpa_failed_only', $q); + $this->assertArrayNotHasKey('bmpa_error_keyword', $q); + } }