GH#701: test(automations): write unit tests for EventTriggerHandler and NotificationDispatcher#705
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 16 minutes and 55 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ationDispatcher Closes #701 Adds PHPUnit tests for: - EventTriggerHandler (register hooks, attach_hooks, execute_event_run with transient handling, disabled/empty hook skipping, completion action firing) - NotificationDispatcher (channel filtering, Slack/Discord payload structure, color coding, field content, reply truncation, HTTP mock via pre_http_request) Tests use WP HTTP API mocking (pre_http_request filter) to avoid live webhook calls. EventTriggerHandler tests use EventAutomations::create/delete for isolation.
Reset static $registered_hooks and $executing properties via reflection in tear_down() to prevent cross-test pollution. Remove init action added by register() to avoid leaking hooks to subsequent test classes.
a6d79a9 to
dc453f9
Compare
Closing SummaryWhat was done
Root cause analysisThe 14 PHPUnit failures were not caused by the new test files — they were pre-existing failures from PRs #692–#696 that were fixed in PR #706 on main. The feature branch was created before that fix was merged, so it didn't have the fixes. Rebasing onto main resolved all 14 failures. Testing evidence
Key decisions
Files changed
Closes #701 aidevops.sh v3.5.466 plugin for OpenCode v1.3.0 with claude-opus-4-6 spent 21m and 11,183 tokens on this as a headless worker. Solved in 1d 18h. |
Summary
pre_http_requestfilter, reply truncation, error status colorsFiles changed
EventTriggerHandlerTest.phpEventTriggerHandlerNotificationDispatcherTest.phpNotificationDispatcherAcceptance criteria
tests/GratisAiAgent/Automations/pre_http_requestfilter (no live webhook calls)Runtime Testing
Risk level: Low — test files only; no production code changes.
Testing method:
self-assessed— PHPCS clean; test structure mirrors existing passing test files.Closes #701
aidevops.sh v3.5.463 plugin for OpenCode v1.3.0 with claude-sonnet-4-6