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); + } }