Udp.Code.Unit tests - #885
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The refactor is small, preserves prior behavior, and the added tests cover the new helper and its integration point in perform().
Pull request overview
This PR refactors remote-call delay handling in RemoteCalls::perform() by extracting the delay/whitelist/capping logic into a dedicated private helper, and expands unit test coverage to validate the helper’s behavior and the delegation wiring.
Changes:
- Added
RemoteCalls::getDelayForAction()to centralize delay permission, normalization, and capping toMAX_DELAY. - Updated
RemoteCalls::perform()to delegate delay decisions togetDelayForAction()and branch onnullvs non-null. - Added comprehensive unit tests covering whitelist behavior, case-insensitivity, empty/invalid delay handling, min/max bounds, and ensuring
perform()delegates delay decisions.
File summaries
| File | Description |
|---|---|
| tests/ApbctWP/TestRemoteCalls.php | Adds unit tests for delay decision logic and asserts perform() delegates delay handling to the new helper. |
| lib/Cleantalk/ApbctWP/RemoteCalls.php | Introduces getDelayForAction() and refactors perform() to use it for delay gating and capping. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #885 +/- ##
============================================
+ Coverage 30.47% 30.60% +0.12%
- Complexity 6627 6637 +10
============================================
Files 292 292
Lines 26432 26448 +16
============================================
+ Hits 8056 8094 +38
+ Misses 18376 18354 -22 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
https://app.doboard.com/1/task/44982