fix(governance-ui): align clear error tool guards with backend

This commit is contained in:
萝卜
2026-03-16 22:37:46 +08:00
parent d13ada0ed8
commit 502c397ec2
2 changed files with 71 additions and 2 deletions

View File

@@ -40,4 +40,54 @@ class AdminPlatformOrderIndexClearErrorButtonsShouldDisableWhenNotInFailedScopeT
// 按钮 disabled宽松断言
$this->assertTrue(str_contains($html, 'type="submit" disabled') || str_contains($html, 'disabled="disabled"'));
}
public function test_clear_sync_errors_button_should_disable_when_syncable_only_checked_even_if_in_failed_scope(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin/platform-orders?sync_status=failed&syncable_only=1');
$res->assertOk();
$html = (string) $res->getContent();
$this->assertStringContainsString('清除同步失败标记(当前筛选范围)', $html);
$this->assertStringContainsString('data-role="clear-sync-errors-blocked-hint"', $html);
$this->assertStringContainsString('只看可同步', $html);
// 仍应禁用
$this->assertTrue(str_contains($html, 'type="submit" disabled') || str_contains($html, 'disabled="disabled"'));
}
public function test_clear_bmpa_errors_button_should_disable_when_syncable_only_checked_even_if_in_bmpa_failed_scope(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin/platform-orders?bmpa_failed_only=1&syncable_only=1');
$res->assertOk();
$html = (string) $res->getContent();
$this->assertStringContainsString('清除批量标记支付失败标记(当前筛选范围)', $html);
$this->assertStringContainsString('data-role="clear-bmpa-errors-blocked-hint"', $html);
$this->assertStringContainsString('只看可同步', $html);
$this->assertTrue(str_contains($html, 'type="submit" disabled') || str_contains($html, 'disabled="disabled"'));
}
public function test_clear_bmpa_errors_button_should_disable_when_sync_failed_filters_present(): void
{
$this->loginAsPlatformAdmin();
// 即使 bmpa_failed_only=1但叠加了 sync_error_keyword/fail_only也应禁用避免误清理
$res = $this->get('/admin/platform-orders?bmpa_failed_only=1&fail_only=1&sync_error_keyword=timeout');
$res->assertOk();
$html = (string) $res->getContent();
$this->assertStringContainsString('清除批量标记支付失败标记(当前筛选范围)', $html);
$this->assertStringContainsString('data-role="clear-bmpa-errors-blocked-hint"', $html);
$this->assertStringContainsString('同步失败', $html);
$this->assertTrue(str_contains($html, 'type="submit" disabled') || str_contains($html, 'disabled="disabled"'));
}
}