test: add tests for console commands #12

Open
opened 2026-02-20 03:15:05 +00:00 by Clotho · 0 comments
Member

Missing Test Coverage

Files:

  • src/Api/Console/Commands/CheckApiUsageAlerts.php
  • src/Api/Console/Commands/CleanupExpiredSecrets.php
  • src/Api/Console/Commands/CleanupExpiredGracePeriods.php

What Needs Testing

CheckApiUsageAlerts

  • Alert triggering at configured thresholds
  • Notification delivery
  • Alert history tracking (prevent duplicate alerts)
  • Multiple workspace handling

CleanupExpiredSecrets

  • Removal of expired webhook secrets
  • Preservation of active secrets during grace period
  • Dry-run mode
  • Logging of cleanup actions

CleanupExpiredGracePeriods

  • Cleanup of expired API key grace periods
  • Preservation of active grace periods
  • Safe handling of concurrent rotations

Implementation Notes

Create src/Api/Tests/Feature/ConsoleCommandsTest.php:

  • Test each command in isolation
  • Mock time to test expiration logic
  • Verify commands are idempotent
  • Test command output and exit codes

Priority

Medium - Scheduled commands affecting production data

TODO.md lines 55-60 mention this as medium priority

## Missing Test Coverage **Files**: - `src/Api/Console/Commands/CheckApiUsageAlerts.php` - `src/Api/Console/Commands/CleanupExpiredSecrets.php` - `src/Api/Console/Commands/CleanupExpiredGracePeriods.php` ### What Needs Testing #### CheckApiUsageAlerts - Alert triggering at configured thresholds - Notification delivery - Alert history tracking (prevent duplicate alerts) - Multiple workspace handling #### CleanupExpiredSecrets - Removal of expired webhook secrets - Preservation of active secrets during grace period - Dry-run mode - Logging of cleanup actions #### CleanupExpiredGracePeriods - Cleanup of expired API key grace periods - Preservation of active grace periods - Safe handling of concurrent rotations ### Implementation Notes Create `src/Api/Tests/Feature/ConsoleCommandsTest.php`: - Test each command in isolation - Mock time to test expiration logic - Verify commands are idempotent - Test command output and exit codes ### Priority Medium - Scheduled commands affecting production data ### Related TODO.md lines 55-60 mention this as medium priority
Clotho added the
discovery
label 2026-02-20 03:15:05 +00:00
Charon added
PHP
testing
P2
and removed
discovery
labels 2026-02-20 12:17:08 +00:00
Clotho was assigned by Charon 2026-02-20 12:21:03 +00:00
Charon added the
agent-ready
label 2026-02-21 01:30:29 +00:00
Sign in to join this conversation.
No description provided.