测试: 治理提示区跨集合链接清理冲突开关护栏

This commit is contained in:
萝卜
2026-03-18 13:51:06 +08:00
parent 6ef2403627
commit 7a369d7653
2 changed files with 50 additions and 0 deletions

View File

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