测试: 治理提示区跨集合链接清理冲突开关护栏
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user